Sails swagger api 文档
Sails swagger api documentation
我在我的节点 js 应用程序中使用 sails。并希望实施 swagger api 文档。我关注 Swagger Sails JS document. I got the result from my api doc. And my expected result from api doc 。我已经在 router.js 文件中编写了路线,如下所示
'post /login': {
controller: 'user/UserController',
action: 'login',
skipAssets: 'true',
//swagger path object
"get": {
"tags": [
"Users"
],
"description": "Get a login user data",
"parameters": [{
"email": "abc@gmail.com",
"password": "12345678y",
"deviceToken": "12345678y",
"deviceType": 2
}],
"responses": {
"200": {
"statusCode": 0,
"status": true,
"message": "string",
"result": {}
}
}
}
}
如果我的路线写错了。那么如何写路由,这样我就可以从 api 文档中得到我预期的结果?
谢谢!
您可以尝试使用 this。
我想路由器文件应该是这样的:
'post /login': {
controller: 'user/UserController',
action: 'login',
skipAssets: 'true',
swagger: {
methods: ["get"],
tags: ["Users"],
description: "Get a login user data",
parameters: [{
email: "abc@gmail.com",
password: "12345678y",
deviceToken: "12345678y",
deviceType: 2
}],
responses: {
'200': {
statusCode: 0,
status: true,
message: "string",
result: {}
}
}
}
}
我在我的节点 js 应用程序中使用 sails。并希望实施 swagger api 文档。我关注 Swagger Sails JS document. I got the result from my api doc. And my expected result from api doc 。我已经在 router.js 文件中编写了路线,如下所示
'post /login': {
controller: 'user/UserController',
action: 'login',
skipAssets: 'true',
//swagger path object
"get": {
"tags": [
"Users"
],
"description": "Get a login user data",
"parameters": [{
"email": "abc@gmail.com",
"password": "12345678y",
"deviceToken": "12345678y",
"deviceType": 2
}],
"responses": {
"200": {
"statusCode": 0,
"status": true,
"message": "string",
"result": {}
}
}
}
}
如果我的路线写错了。那么如何写路由,这样我就可以从 api 文档中得到我预期的结果?
谢谢!
您可以尝试使用 this。
我想路由器文件应该是这样的:
'post /login': {
controller: 'user/UserController',
action: 'login',
skipAssets: 'true',
swagger: {
methods: ["get"],
tags: ["Users"],
description: "Get a login user data",
parameters: [{
email: "abc@gmail.com",
password: "12345678y",
deviceToken: "12345678y",
deviceType: 2
}],
responses: {
'200': {
statusCode: 0,
status: true,
message: "string",
result: {}
}
}
}
}