【发布时间】:2019-03-04 06:19:33
【问题描述】:
我定义了几个端点。我正在对所有这些进行自动化处理,此外还定义了一些我应该得到错误的场景。
例如,端点之一是:'/v1/templates'。
现在,想象一下,用户键入了“/v1/templatess”。
我正在使用 app.get 来处理这样的已知端点:
app.get(
'/v1/contents/:template_component_content_id',
controllers.template_component_contents.getById.bind(controllers.template_component_contents)
);
有没有办法说如果调用的端点与任何 app.get() 选项不匹配,则抛出错误?
提前致谢。
【问题讨论】:
标签: node.js api express http-status-code-403