-
Notifications
You must be signed in to change notification settings - Fork 0
/
server-local.js
43 lines (38 loc) · 1.12 KB
/
server-local.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
40
41
42
43
/**
* Created by xiaojianli on 2017/6/29.
*/
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const config = require('./webpack.config.dev.js');
const app = express();
const compiler = webpack(config);
const webpackDevOptions = {
noInfo:true,
historyApiFallback:true,
publicPath:config.output.publicPath,
headers:{
'Access-Control-Allow-Origin':'*'
}
};
app.use(require('webpack-dev-middleware')(compiler,webpackDevOptions));
app.use(require('webpack-hot-middleware')(compiler));
app.get('/',function (req,res) {
res.sendFile(path.join(__dirname,'index.html'));
});
app.get('/resume/resume1.html',function (req,res) {
res.sendFile(path.join(__dirname,'/resume/resume1.html'));
});
app.get('/resume/resume2.html',function (req,res) {
res.sendFile(path.join(__dirname,'/resume/resume2.html'));
});
app.get('/*.*',function (req,res) {
res.sendFile(path.join(__dirname,req.url));
});
app.listen(80,'0.0.0.0',function (err) {
if(err){
console.log(err);
return;
}
console.log('Listening at http://172.19.28.49:80');
});