如何摆脱Sails.js中的req.params.id

时间:2017-02-16 15:08:16

标签: node.js sails.js

我在≈ / controllers / UserController.js'中创建了控制器。并在那里创建了一个动作:

hello: function(req, res){
    console.log('PARAMS:', req.params);
    return res.send('hello');
}

当我点击地址线" http://localhost:1337/user/hello/erer" console.log()说:

PARAMS: [ id: 'erer' ]

但我需要404.

在config / blueprint.js中我更改了几行:

rest: false,
shortcuts: false,

1 个答案:

答案 0 :(得分:0)

正如documentation所述,为了在一个控制器上禁用蓝图,您必须通过导出对象_config来覆盖控制器内的蓝图配置