Skip to content

Instantly share code, notes, and snippets.

@cgatian
Created October 18, 2016 15:09
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 cgatian/519e2fec28a9b6181a0f1a8f76cc3144 to your computer and use it in GitHub Desktop.
Save cgatian/519e2fec28a9b6181a0f1a8f76cc3144 to your computer and use it in GitHub Desktop.
Simple Express Server with gzip
'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