Skip to content

Instantly share code, notes, and snippets.

@lakshaygupta21
Created May 28, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshaygupta21/3ba45a8f872819483416b1e961ad79a3 to your computer and use it in GitHub Desktop.
Save lakshaygupta21/3ba45a8f872819483416b1e961ad79a3 to your computer and use it in GitHub Desktop.
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