forked from Mindaugus/turbo-potato
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
39 lines (34 loc) · 982 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
37
38
39
const express = require('express');
const bodyParser = require('body-parser');
const webpack = require('webpack');
const config = require('./webpack.config.js');
const webpackMiddleware = require("webpack-dev-middleware");
const compiler = webpack(config);
const app = express();
const port = process.env.PORT || 8000;
app.use(bodyParser.urlencoded({ extended: true }));
/*app.use(webpackMiddleware(compiler, {
noInfo: false,
quiet: false,
lazy: true,
watchOptions: {
aggregateTimeout: 300,
poll: true,
},
publicPath : config.output.publicPath,
index: "index.html",
headers: { "X-Custom-Header": "yes" },
stats: {
colors: true,
},
reporter: null,
serverSideRender: false,
}));*/
require('./app/routes')(app);
app.use(express.static('./build'));
app.get('/', (req, res) => {
res.sendFile(__dirname + '/app/front/index.html');
});
app.listen(port, () => {
console.log('We are live at port ' + port);
});