Last active
January 2, 2018 16:55
-
-
Save ealipio/95d7e1e47ce539940116ae69d76ba6d5 to your computer and use it in GitHub Desktop.
node http server
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
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