Skip to content

Instantly share code, notes, and snippets.

@boreycutts
Last active March 21, 2020 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boreycutts/1202270bf75581281805620535ffb71a to your computer and use it in GitHub Desktop.
Save boreycutts/1202270bf75581281805620535ffb71a to your computer and use it in GitHub Desktop.
Simple Webserver
const DEFAULT_PORT = 8080;
let express = require('express'),
app = express();
app.use(express.static(__dirname + '/client'));
app.set('port', process.env.PORT || DEFAULT_PORT);
app.get('/' , function(req,res,next) {
res.sendfile('views/index.html');
});
let http = require('http'),
fs = require('fs');
http.createServer({ }, app).listen(app.get('port'));
console.log("Server listening for http connections on port ", app.get('port'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment