Last active
March 2, 2018 13:42
-
-
Save ConnectedReasoning/52a0db5e86f8a46adb5fc0aae49801e4 to your computer and use it in GitHub Desktop.
Simple Node Express server
This file contains 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
'use strict' | |
const express = require('express'); | |
const http = require('http'); | |
const path = require('path'); | |
let app = express(); | |
let publicPath = path.resolve(__dirname + '/dist/'); | |
app.use(express.static(publicPath)); | |
app.get("/", function(req, res) { | |
console.log('from app get') | |
res.sendFile(publicPath + 'index.html'); | |
}); | |
var localport = process.env.PORT || 3200; | |
console.log(`listening on ${localport}`) | |
http.createServer(app).listen(localport); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment