forked from 81735595/mission-center
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.bak.js
78 lines (66 loc) · 2.05 KB
/
server.bak.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var webpack = require('webpack')
var webpackDevMiddleware = require('webpack-dev-middleware')
var webpackHotMiddleware = require('webpack-hot-middleware')
var config = require('./webpack.config')
var app = new (require('express'))()
var port = 3000
var ctx = process.env.CTX_ENV ? process.env.CTX_ENV : ''
var compiler = webpack(config)
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }))
app.use(webpackHotMiddleware(compiler))
app.get("/", function(req, res) {
res.sendFile(__dirname + '/index.html')
})
app.get(ctx + "/tc/curtasks", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/ongoing.json')
}, 2000)
})
app.get(ctx + "/tc/copytasks", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/chaosong.json')
}, 2000)
})
app.get(ctx + "/tc/histasks", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/done0.json')
}, 2000)
})
app.get(ctx + "/tc/getMine", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/mine3.json')
}, 2000)
})
app.get(ctx + "/tc/getSearchPagedItem", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/mine3.json')
}, 2000)
})
app.get(ctx + "/tc/getItems", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/items.json')
}, 2000)
})
app.get(ctx + "/tc/getSearchItems", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/items.json')
}, 2000)
})
app.post(ctx + "/iform_ctr/iform_design_ctr/queryFormList", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/formList.json')
}, 2000)
})
app.get(ctx + "/tc/getbo", function(req, res) {
setTimeout(function () {
res.sendFile(__dirname + '/mock/getbo.json')
}, 2000)
})
app.listen(port, function(error) {
if (error) {
console.error(error)
} else {
var path = 'http://localhost:' + port
console.info("==> 🌎 Listening on port %s. Open up %s/ in your browser.", port, path)
}
})