我在本地請(qǐng)求了json數(shù)據(jù),并且模擬了接口,怎么放到weex項(xiàng)目中?我嘗試放入webpack.dev.js中綁定express,可是還是請(qǐng)求不到。請(qǐng)問怎么解決var app = express()var appData = require('./data.json')console.log(appData);var varieties = appData.varietiesvar recommends = appData.recommendsconsole.log(varieties)var apiRouters = express.Router()apiRouters.get('/varieties', function (req, res) { res.json({ errno: 0, data: varieties })})apiRouters.get('/newsVarieties/recommends', function (req, res) { res.json({ errno: 0, data: recommends })})app.use('/api', apiRouters)
- 1 回答
- 0 關(guān)注
- 1003 瀏覽
添加回答
舉報(bào)
0/150
提交
取消