Skip to content

Instantly share code, notes, and snippets.

@ConnectedReasoning
Last active March 2, 2018 13:42
Show Gist options
  • Save ConnectedReasoning/52a0db5e86f8a46adb5fc0aae49801e4 to your computer and use it in GitHub Desktop.
Save ConnectedReasoning/52a0db5e86f8a46adb5fc0aae49801e4 to your computer and use it in GitHub Desktop.
Simple Node Express server
'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