Search code examples
swagger

Add Swagger UI for user to test endpoints


This might look as a newbie question.

Is there a way to have Swagger User Interface in my project?

Is this possible in localhost?

I want to have a interface for the user to test my API to see is the data is being handled the correct way.


Solution

    1. Download the swagger-ui HTML/JS project from the release branch https://github.com/swagger-api/swagger-ui/releases
    2. Copy the contents of /dist folder of the zip file to tomcat/webapps directory
    3. To show multiple APIs edit the swagger-initializer.js file as mentioned in the below link Swagger UI with Multiple Urls
    4. Access the UI http://localhost:8080/swagger-ui/

    if you are using any other web server the above still holds good