Created
May 28, 2020 17:53
-
-
Save lakshaygupta21/3ba45a8f872819483416b1e961ad79a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const swaggerOptions = { | |
swaggerDefinition: { | |
info: { | |
title: "Documenting REST API's", | |
description: "This is an implementation of how to document your RESTful API's using SWAGGER", | |
servers: ['http://localhost:3000'] | |
}, | |
"components": { | |
"schemas": { | |
"fruits": { | |
"properties": { | |
"name": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
}, | |
apis: ['./routes/api/fruits.js'] | |
} | |
const swaggerDocs = swaggerJsonDoc(swaggerOptions) | |
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment