-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
36 lines (29 loc) · 812 Bytes
/
server.js
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
26
27
28
29
30
31
32
33
34
35
36
/* eslint-env node */
'use strict';
const express = require('express');
const compression = require('compression');
const rollup = require('express-middleware-rollup');
const bodyParser = require('body-parser');
const port = process.env.PORT || 4321;
const app = express();
app.use(express.static('./static/scripts'));
app.use(compression());
app.use(rollup({
src: 'src',
dest: './static',
bundleExtension: '.js',
type: 'application/javascript',
rebuild: 'always',
serve: 'on-compile',
bundleOpts: {
format: 'es',
}
}));
app.use(express.static('./static'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use((request, res, next) => {
console.log(`${request.method}: \t ${request.url}`);
next();
});
app.listen(port);