1 Star 0 Fork 1

timeless09 / shell

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
prod.server.js 993 Bytes
一键复制 编辑 原始数据 按行查看 历史
Scale 提交于 2017-12-23 01:47 . first commit
var express = require('express')
var config = require('./config/index')
var port = process.env.PORT || config.build.port
var app = express()
var router = express.Router()
router.get('/', function (req, res ,next) {
req.url = 'index.html'
next()
})
app.use(router)
var appData = require('./data.json')
var seller = appData.seller
var goods = appData.goods
var ratings = appData.ratings
// **********加载mock数据**********
var apiRoutes = express.Router()
apiRoutes.get('/seller', function (req,res) {
res.json({
errno: 0,
data: seller
})
})
apiRoutes.get('/goods', function (req,res) {
res.json({
errno: 0,
data: goods
})
})
apiRoutes.get('/ratings', function (req,res) {
res.json({
errno: 0,
data: ratings
})
})
app.use('/api', apiRoutes)
app.use(express.static('./dist'))
module.exports = app.listen(port, function (err) {
if (err) {
console.log(err)
return
}
console.log('Listening at http://localhost:' + port + '\n')
})
1
https://gitee.com/timeless09/shell.git
git@gitee.com:timeless09/shell.git
timeless09
shell
shell
master

搜索帮助