-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (17 loc) · 717 Bytes
/
server.js
File metadata and controls
25 lines (17 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
const express = require('express');
const morgan = require('morgan');
const directory = require('serve-index');
const log = require('fancy-log');
var app = express();
app.disable('etag');
app.use(morgan('dev'));
app.use((req, res, next) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
req.headers['if-none-match'] = 'no-match-for-this';
next();
});
app.use(express.static('dist', { etag: false, maxAge: 5 }));
app.use(directory('dist', { 'icons': true }));
app.get('/i', (req, res) => res.send(''));
app.listen(process.env.PORT || 8000, () => log('Listening on http://127.0.0.1:8000'));