Javascript 如何为使用节点restful包生成的API方法集成基于角色的访问令牌身份验证?
我正在使用node restful包自动生成API。 但我不知道如何为自动生成的每个API方法GET、POST、PUT和DELETE集成基于角色的访问令牌验证 例如:Javascript 如何为使用节点restful包生成的API方法集成基于角色的访问令牌身份验证?,javascript,node.js,authentication,Javascript,Node.js,Authentication,我正在使用node restful包自动生成API。 但我不知道如何为自动生成的每个API方法GET、POST、PUT和DELETE集成基于角色的访问令牌验证 例如: var Resource = app.resource = restful.model('resource', mongoose.Schema({ title: String, year: Number, })) .methods(['get', 'post', 'put', 'delete']); Re
var Resource = app.resource = restful.model('resource', mongoose.Schema({
title: String,
year: Number,
}))
.methods(['get', 'post', 'put', 'delete']);
Resource.register(app, '/resources');
我想管理员有权访问所有上述方法,但一个普通的用户应该只有访问post和get方法
请帮我做这个。谢谢