Skip to content

Easy get and post api to understand how to document any api using Swagger.

Notifications You must be signed in to change notification settings

harsh6768/easydoc-swagger

Repository files navigation

❤️ Star ❤️ the repo to support the project or 😄Follow Me.Thanks!

easydoc-swagger

  1. clone repository

     git clone https://github.com/harsh6768/easydoc-swagger.git
    
  2. install all npm modules

    npm install 
    

See Swagger Documentation:

localhost:5000/documentation

npm module swagger-jsdoc will help to write documentation in js file.

Understand documentation of swagger:

/**
 * @swagger
 * /user:                                                             // user is the route for the request
 *      post:                                                         // define the type of request
 *        tags:                                                       // tags will help to group the apis
 *        - user
 *        summary: create user
 *        description: This operation creates user
 *        consumes:                                                
 *        - application/json
 *        - application/xml
 *        produces:
 *        - application/json
 *        - application/xml
 *        parameters:                                                 //define parameters for post request
 *        - in: body
 *          name: body
 *          description: create new user to authenticate
 *          required: true
 *          schema:                                                  //define schema for post request
 *            $ref: "#/definitions/User"
 *        responses:                                                 //define responses 
 *            200:
 *              description: successful
 *            400:
 *              description: bad request
 *            500:
 *              description: internal server error
 * definitions:
 *      User:
 *         type: object
 *         properties:
 *              username:
 *                  type: string
 *              email:
 *                  type: string
 *              password:
 *                  type: string
 * 
 *      
 *       
 */

Visit Swagger Documentation to learn more

About

Easy get and post api to understand how to document any api using Swagger.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published