Created
October 18, 2016 15:09
-
-
Save cgatian/519e2fec28a9b6181a0f1a8f76cc3144 to your computer and use it in GitHub Desktop.
Simple Express Server with gzip
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'; | |
let path = require('path'); | |
let express = require('express'); | |
let compression = require('compression'); | |
// Constants | |
let PORT = 8080; | |
// App | |
let app = express(); | |
app.use(compression()); | |
app.use('/', express.static(path.join(__dirname + '/dist'))); | |
app.get('/', function(req, res) { | |
res.sendFile(path.join(__dirname + '/dist/index.html')); | |
}); | |
app.listen(PORT); | |
console.log('Running on http://localhost:' + PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment