Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
prod.server.js 777 Bytes
Copy Edit Raw Blame History
ustbhuangyi authored 2018-11-03 10:26 . finish all the feature
const express = require('express')
const app = express()
const appData = require('./data.json')
const seller = appData.seller
const goods = appData.goods
const ratings = appData.ratings
const router = express.Router()
router.get('/seller', function (req, res) {
res.json({
errno: 0,
data: seller
})
})
router.get('/goods', function (req, res) {
res.json({
errno: 0,
data: goods
})
})
router.get('/ratings', function (req, res) {
res.json({
errno: 0,
data: ratings
})
})
app.use('/api', router)
app.use(express.static('./dist'))
const port = process.env.PORT || 8900
module.exports = app.listen(port, function (err) {
if (err) {
console.log(err)
return
}
console.log('Listening at http://localhost:' + port + '\n')
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化