我有以下代码:
路线:
router.get('/students', function(req, res,next) {
studentsApi.getAllStudents(function(err, items) {
res.json( {student:items});
})
});
api.js:
let jsonData= require('./students');
let jsoneData=JSON.parse(jsonData);
let _copy = function(item) {
return JSON.parse(JSON.stringify(item));
};
let studentsApi = {
getAllStudents: function(callback) {
callback(null, _copy(jsoneData));
}
}
module.exports = studentsApi;
我可以在localhost:3000
上看到默认的快递页面,但是localhost:3000/students
返回 404错误。学生是一个js文件