mock 不能正常使用
来源:2-3 api 接口 mock

慕斯卡6387138
2019-02-23
const appData=require('./data.json')
const seller =appData.seller
const goods =appData.goods
const ratings =appData.ratings
devServer:{
before(app){
app.get('/api/seller',function(req,res){
res.json({
errro:0,
data:seller
})
})
app.get('/api/goods',function(req,res){
res.json({
errro:0,
data:goods
})
})
app.get('/api/ratings',function(req,res){
res.json({
errro:0,
data:ratings
})
})
}
}
data.josn 自定义了 访问 http://localhost:8080/#/api/seller 的时候不能访问到数据
写回答
3回答
-
andy想要简单点
2019-02-24
你这个已经改了配置了, 不是单纯的改页面 。 你要从新serve一次 这样你的配置才会编译进去
122019-05-21 -
zhaiduting
2019-02-23
多了个井号
00 -
ustbhuangyi
2019-02-23
二期视频的话应该是 http://localhost:8080/api/seller 吧
00
相似问题