Node.js 未找到路线未在Sailsjs中找到

Node.js 未找到路线未在Sailsjs中找到,node.js,model-view-controller,routing,sails.js,Node.js,Model View Controller,Routing,Sails.js,基于,可以在routes文件中添加语法如下的响应: module.exports.routes = { '/foo': {response: 'notFound'} }; module.exports.routes = { 'get /myroute/:myPara/': 'MyController.getAll', 'get /myroute/:myPara/': 'MyController.getOne', 'post /myroute/:myPara/

基于,可以在routes文件中添加语法如下的响应:

module.exports.routes = {
    '/foo': {response: 'notFound'}
};
module.exports.routes = {
    'get  /myroute/:myPara/': 'MyController.getAll',
    'get  /myroute/:myPara/': 'MyController.getOne',
    'post /myroute/:myPara/': 'MyController.create',
    '/*' : {response: 'notFound'}
};
这将在
/response
目录中搜索
notFound.js
文件,我在那里找到了它

因此,在我的
routes.js
文件中,我添加了这个作为其他路由的结尾,以便捕获未找到的路由,它是这样的:

module.exports.routes = {
    '/foo': {response: 'notFound'}
};
module.exports.routes = {
    'get  /myroute/:myPara/': 'MyController.getAll',
    'get  /myroute/:myPara/': 'MyController.getOne',
    'post /myroute/:myPara/': 'MyController.create',
    '/*' : {response: 'notFound'}
};
我意识到永远找不到最后一条路线,我也尝试过删除斜杠(执行
“*”
),但没有任何效果


我错过什么了吗?谢谢

船帆已经在处理404 notFound:

Sails调用res.notFound(),您可以覆盖默认的notFound():

res.notFound()
(与其他userland响应方法一样)可以被覆盖或修改。它运行/responses/notFound.js中定义的响应方法,该方法自动绑定到新生成的Sails应用程序中。如果应用程序中不存在notFound.js响应方法,则Sails将隐式使用默认行为