1.0.2 ā€¢ Published 7 months ago

@collinsadi/swagger v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

@collinsadi/swagger

npm version

šŸš€ @collinsadi/swagger is an npm package that automates the generation of Swagger documentation for Express.js applications. Document your routes with ease and share them with your team!

Installation

You can install this package via npm:

npm install @collinsadi/swagger

Usage

Import the Package

const generateSwaggerDocumentation = require("@collinsadi/swagger");

Generate Swagger Documentation

// Create an Express app
const express = require("express");
const app = express();

// Generate Swagger documentation for your Express app
generateSwaggerDocumentation(app, port, live);
  • app: Your Express application.
  • port: The port on which your server is running.
  • live: Optional. The deployment server URL.

šŸ‘‰ Note: @collinsadi/swagger takes the name of the function assigned to the routes as a description for the route. Currently, it supports routes declared in the app.js. Stay tuned for future updates to expand support to routes imported from other files.

Swagger UI

After generating the Swagger documentation, you can view it using Swagger UI by navigating to:

http://your-server/docs

Example

// Create an Express app
const express = require("express");
const generateSwaggerDocumentation = require("@collinsadi/swagger");
const app = express();


app.listen(2000, () => {
    
    console.log("Server Started")
})

const createUser = (req, res)=>{

    res.send("User Created")

}

app.get("/users/create", createUser)

// Generate Swagger documentation for your Express app
generateSwaggerDocumentation(app, 2000, "https://collinsadi.vercel.app");

Local Image

šŸŒŸ We welcome contributions! This project is open source and open for collaboration. Feel free to contribute, report issues, and help improve this package.

Features To Be Implemented

We have exciting plans for the future of @collinsadi/swagger, including:

  • Support for routes imported from external files.
  • Enhanced configuration options for fine-tuning your documentation.
  • Integration with additional tools and frameworks.

Stay tuned for these upcoming features and be part of our open-source journey!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

šŸŒ Connect with us on GitHub and let's make Swagger documentation a breeze!