-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (19 loc) · 657 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (19 loc) · 657 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
26
27
var koa = require('koa');
var serve = require('koa-static');
var webpack = require('webpack');
var devMiddleware = require("koa-webpack-dev-middleware");
var hotMiddleware = require("koa-webpack-hot-middleware");
var webpackConfig = require('./webpack.config');
var main = require("./routes/main.js");
var app = koa();
var compiler = webpack(webpackConfig);
app.use(devMiddleware(compiler, {
noInfo: true, publicPath: webpackConfig.output.publicPath
}));
app.use(hotMiddleware(compiler, {
log: console.log, path: '/__webpack_hmr', heartbeat: 10 * 1000
}));
app.use(serve('./public'));
app.use(main.get2);
app.use(main.get);
app.listen(8080);