Hello,
I have installed the swagger module and it’s generating Swagger JSON of API.
But my question is how API developer can see my document as public users. For the example of a pet.
https://petstore.swagger.io/
Do we have this feature in the swagger module?
Or Any suggestion on how I can make my swagger doc like https://petstore.swagger.io/ for public use?
Hello. You can download Swagger UI and place it within your project.
https://swagger.io/tools/swagger-ui/
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API. - GitHub - swagger-api/swagger-ui: Swagger UI is a col...
For a quick implementation, I would suggest trying the plain HTML route (the directions are at the bottom of this link)
# Installation
## Distribution channels
### NPM Registry
We publish two modules to npm: **`swagger-ui`** and **`swagger-ui-dist`**.
**`swagger-ui`** is meant for consumption by JavaScript web projects that include module bundlers, such as Webpack, Browserify, and Rollup. Its main file exports Swagger UI's main function, and the module also includes a namespaced stylesheet at `swagger-ui/dist/swagger-ui.css`. Here's an example:
```javascript
import SwaggerUI from 'swagger-ui'
// or use require if you prefer
const SwaggerUI = require('swagger-ui')
SwaggerUI({
dom_id: '#myDomId'
})
```
This file has been truncated. show original
Once you have that in your site (maybe in the resources folder or wherever makes sense for you), just update the Swagger path in the index.html file to point to your Swagger JSON
url: “/cbswagger”,
If you see any errors, make sure that the Swagger file is able to load properly. Thanks!
-Daniel
1 Like
Thanks for the good suggestion. I was thinking this module supporting UI as well.