-
Notifications
You must be signed in to change notification settings - Fork 21
2.1 Routers
leonardo Rico edited this page Dec 3, 2017
·
8 revisions
Create a file with .yaml extension in the /src/api/swagger folder
src/api/swagger/hello.yaml
/api/hello:
x-swagger-router-controller: hello
get:
operationId: list
x-hide: false
tags:
- Hello
summary: Get list Hello's
responses:
200:
description: Success
404:
description: Not found
500:
description: Error
Create a file with .yaml extension in the /src/api/swagger folder
src/api/swagger/hello.yaml
/api/hello:
x-swagger-router-controller: hello
get:
operationId: list
security:
- Bearer: []
x-security-scopes:
- admin
- other
tags:
- Hello
summary: Get list Hello's
description: Returns all hello
responses:
200:
description: Success
404:
description: Not found
500:
description: Error
- /api/hello: url example http://localhost:3000/api/hello
- x-swagger-router-controller: Controller name in src/api/controllers/hello.js
- get: REST operations (get, post, put, delete, patch)
-
- operationId: Name method from src/api/controllers/hello.js
-
- x-hide: Show or hide router in swagger specification /docs (By default is false)
-
- security: Middleware
-
- x-security-scopes: Roles required in Middleware
-
- tags: Tag for docs to swaggger /docs
-
- summary: Summary for docs to swagger
-
- description: Description for docs to swagger
-
- responses: States of possible responses
More info in Swagger Specification
Nodetomic Api Swagger