Skip to content

Instantly share code, notes, and snippets.

@ealipio
Last active January 2, 2018 16:55
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 ealipio/95d7e1e47ce539940116ae69d76ba6d5 to your computer and use it in GitHub Desktop.
Save ealipio/95d7e1e47ce539940116ae69d76ba6d5 to your computer and use it in GitHub Desktop.
node http server
var express = require('express'),
app = express(),
cors = require('cors'),
bodyParser = require('body-parser'),
morgan = require('morgan'),
path = require('path');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(morgan('dev'));
app.use(cors());
app.use(express.static(__dirname + '/app'));
app.get('*', (req, res) => res.sendFile(path.join(__dirname + '/index.html')) );
app.listen(8080);
console.log('running on 8080');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment