Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save azizkale/94928aa83cdedd4cb910a387ab040951 to your computer and use it in GitHub Desktop.
Save azizkale/94928aa83cdedd4cb910a387ab040951 to your computer and use it in GitHub Desktop.
const options = {
definition: {
openapi: "3.0.0",
info: {
title: "Library API",
version: "1.0.0",
description: "A simple Express Library API",
termsOfService: "http://example.com/terms/",
contact: {
name: "API Support",
url: "http://www.exmaple.com/support",
email: "[email protected]",
},
},
servers: [
{
url: "http://localhost:4001",
description: "My API Documentation",
},
],
},
apis: ["./Routes/*.js"],
};
const specs = swaggerJsDoc(options);
app.use("/api-docs", swaggerUI.serve, swaggerUI.setup(specs));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment