-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathserver.js
32 lines (25 loc) · 813 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
var express = require('express');
var webpack = require('webpack');
var path = require('path');
var config = require('./webpack.config');
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
stats: {
colors: true
}
}));
app.use(require('webpack-hot-middleware')(compiler));
app.use(express.static(process.cwd()));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});
app.get('/test', function(req, res) {
res.sendFile(path.join(__dirname + '/test/index.test.html'));
});
app.get('/test_story', function(req, res) {
res.sendFile(path.join(__dirname + '/test/index.story.test.html'));
});
app.listen(process.env.PORT, function () {
console.log('[APP] Listening in port ' + process.env.PORT);
})