API with Swagger UI
JSDoc is a popular tool for generating documentation from comments in the source code of your app. This serves two purposes. First, the documentation is directly available to anyone viewing the source code. Second, the comments can be compiled later into a complete set of reference documentation.
Swagger provides a tool for presenting this documentation: Swagger UI. Swagger UI creates a web page from OpenAPI Specification definitions. As this tutorial will show, these definitions can be written in YAML directly in JSDoc comments.
In this tutorial, you will set up a Swagger UI documentation web page for an Express API. You can then write JSDoc comments in your API's source code to generate the OpenAPI definitions. By the end, you will have documentation that follows the OpenAPI Specification, presented from a custom /docs
endpoint added to your Express API:
Swagger API s
- https://swagger.io
- https://petstore.swagger.io/
- https://editor.swagger.io
- Download Swagger Editor, and clone into local system
Install swagger API s
- download json file from editor.swagger.io
- To install JSON Swagger into System :: npm install -g swagger