Last active
March 21, 2020 14:31
-
-
Save boreycutts/1202270bf75581281805620535ffb71a to your computer and use it in GitHub Desktop.
Simple Webserver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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