我有这些主要路线
// redirect routes
app.get("router").get("/songs/all", function(req, res){
res.redirect("/#/songs/all");
});
// API Routes
app.get("router").use("/api/songs", require("./songsController.js")(app));
songsController.js看起来像这样
module.exports = function(app){
app.get("router").get("/all", function(req, res){
var page = parseInt(req.query.page) || 1;
var limit = parseInt(req.query.limit) || 12;
var offset = (page - 1) * limit;
models.Song.findAll({
limit: limit,
offset: offset
}).then(function(songs){
res.json(songs);
}).catch(function(errors){
res.send(errors);
});
});
return app.get("router");
};
现在的问题是,当我在邮递员中打开/songs/all
网址时,我会收到来自/api/songs/all
网址的回复