An express application with swagger, swagger-jsdoc, express-swagger-ui and redoc.
expressjs
CRUD application.swagger-jsdoc
to write the specsexpress-swagger-ui
to show the Swagger interface.redoc
for mobile friendly API documentation.- Use RapidAPI for documenation, testing, discovery and integration of API
> npm init
> npm i express lowdb@1.0.0 morgan nanoid cors swagger-jsdoc@6.0.1 swagger-ui-express redoc-express
To see the swagger documentation go to http://localhost:4000/api/v1/api-docs/.
> git clone https://github.com/murshidazher/express-swagger-api.git
> cd express-swagger-api
> npm install
> npm start
- We need to create a multi-line comment with
@swagger
. - In
components
section we define the schema which could be re-used with theref
keyword. - We define
tags
to group our requests, without them appearing in thedefault
group.
List of Endpoints of /api/v1/
,
Endpoints | Description |
---|---|
/api-docs |
Interactive SwaggerUI |
/docs |
Redoc mobile friendly documentation |
/docs/swagger.json |
Download OpenAPI3 Specification in JSON |
- Example pet-api OpenAPI specification.
MIT © 2021 Murshid Azher.