Code Monkey home page Code Monkey logo

kaibur_task_backend-api-doc-swagger's Introduction

Kaiburr_task_backend-api-doc-swagger

Here we will document our api using swagger. Swagger is just an amazing tool to document our api. This is really helpful for the client side developer as he can easily see what methods to call in the client side. We will be generating html format documentation with the help of swagger.

We will just add the following dependency to pom.xml and pom.xml will look like this.

 <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.9.2</version>
 </dependency>

<dependency>
    <groupId>io.springfox</groupId>
     <artifactId>springfox-swagger-ui</artifactId>
     <version>2.9.2</version>
</dependency>

Screenshot from 2020-02-20 03-09-22

In the main class add the following annotation @EnableSwagger2

Screenshot from 2020-02-20 03-10-47

We are all set to go. Dont forget to run clean maven build. Now rerun the server again and we will see the following output in the link - http://localhost:8080/swagger-ui.html#/. After opening the link will look like this.

Screenshot from 2020-02-20 03-14-28

Just open the server controller and it will look like this. We can see the url mapping that we have mentioned in our springboot application.

Screenshot from 2020-02-20 03-15-49

Request Results on swagger

Get All

Click on get and then click on try out and then press execute. We will get all the objects stored in mongo database.

Screenshot from 2020-02-20 03-19-07

Get By Id

Screenshot from 2020-02-20 03-21-39

Post

Screenshot from 2020-02-20 03-25-34

Screenshot from 2020-02-20 03-25-59

Delete By Id

Screenshot from 2020-02-20 03-29-20

Screenshot from 2020-02-20 03-29-40

Get By Name

Screenshot from 2020-02-20 03-27-58

kaibur_task_backend-api-doc-swagger's People

Contributors

foreverankit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.