1
試圖單獨的API和Web路線:單獨的API和Web的路線
路線/ index.js
var api = function() {
router.get('/:id', function (req, res, next) {
...
});
return router;
}
var web = function() {
router.get('/:id', function (req, res, next) {
...
});
return router;
}
module.exports = {
api: api,
web: web
};
app.js
var indexAPI = require('./app/routes/accounts').api;
var indexWeb = require('./app/routes/accounts').web;
app.use('/api/index', indexAPI);
但沒有成功路。
這是一個錯字? var wen = function(){...也許它應該是web – Oscar
我改變它,不,它不是那個問題,api也不能訪問。 – Alvin