Skip to content

Commit

Permalink
Removes the need for extra server (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Jan 17, 2018
1 parent 7fa2ff8 commit 1663b90
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"unrestricted": "node gun-servers/server-gun-unrestricted",
"restricted": "node gun-servers/server-gun-restricted",
"start": "node www/server",
"start-unauth": "node www/server-unauthenticated",
"start-unauth": "node www/server 4000 not-authenticated.html",
"refresh": "rm -rf node_modules && rm package-lock.json && npm install"
},
"standard": {
Expand Down
File renamed without changes.
17 changes: 0 additions & 17 deletions www/server-unauthenticated.js

This file was deleted.

9 changes: 5 additions & 4 deletions www/server.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')

const port = process.argv[2] || 3000
const index = process.argv[3] || 'authenticated.html'
// Serve up public/ftp folder
const serve = serveStatic('www', {'index': ['index.html', 'index.htm']})
const serve = serveStatic('www', {'index': [index]})

// Create server
const server = http.createServer(function onRequest (req, res) {
serve(req, res, finalhandler(req, res))
})

// Listen
server.listen(3000)
server.listen(port)

console.log('authenticated www server started on port 3000')
console.log(`server started on port: ${port}`)
console.log('Use CTRL + C to stop it')

0 comments on commit 1663b90

Please sign in to comment.