-
Notifications
You must be signed in to change notification settings - Fork 265
/
express.js
26 lines (21 loc) · 656 Bytes
/
express.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
const express = require('express');
const fastbootMiddleware = require('fastboot-express-middleware');
const FastBoot = require('fastboot');
let app = express();
let fastboot = new FastBoot({
distPath: `${__dirname}/dist`,
sandboxGlobals: {
XMLHttpRequest: require('xmlhttprequest').XMLHttpRequest,
WebSocket: require('ws'),
clearInterval: clearInterval,
setInterval: setInterval
}
});
let middleware = fastbootMiddleware({
fastboot: fastboot
});
app.use('/assets', express.static(`${__dirname}/dist/assets`));
app.all('/*', middleware);
app.listen(3000, function () {
console.log('FastBoot app listening on port 3000!');
});