options
介绍
用于探查目标接口,允许那些请求方式。
Koa-Router 开启 options
只需1行代码;
app.use(usersRouter.allowedMethods());
RESTful API 最佳实践
获取 get
返回详情
提交 post
返回新建的数据
更新 put
修改后的详情
删除 delete
返回 204 (Not Content)
用于探查目标接口,允许那些请求方式。
只需1行代码;
app.use(usersRouter.allowedMethods());
返回详情
返回新建的数据
修改后的详情
返回 204 (Not Content)