Deb*_*jit 3 javascript node.js loopbackjs
我有一个远程方法,我将我的应用程序逻辑,如下所示:
module.exports = function(Entity) {
HcpEntity.retrieveProfile = function(body, cb) {
process.nextTick(function() {
//TODO: Application Logic
}
}
}
Run Code Online (Sandbox Code Playgroud)
相应的模型JSON片段是:
{
"name": "HcpEntity",
"base": "Model",
"properties": {},
"methods": {
"retrieveProfile": {
"isStatic" : true,
"accepts": [
{
"arg": "Request",
"type": "object",
"required": true,
"http": {
"source": "body"
}
}
],
"returns": {
"arg": "Response",
"type": "object"
},
"http": {
"verb": "post"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我需要能够访问标记为的区域中的传入HTTP标头 //TODO: Application Logic以验证它们.请有人帮忙.
Ste*_*rex 10
对于远程方法accepts使用 -
accepts: [
{arg: 'req', type: 'object', http: {source: 'req'}}
],
Run Code Online (Sandbox Code Playgroud)
请求标头必须可用req.headers.
请参阅:https://loopback.io/doc/en/lb3/Remote-methods.html#http-mapping-of-input-arguments
| 归档时间: |
|
| 查看次数: |
2037 次 |
| 最近记录: |