New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@collinsadi/swagger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collinsadi/swagger

An Express.js middleware for auto-generating Swagger documentation from your routes, with support for route descriptions based on function names. Open-source and easy-to-use for documenting your Express applications.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

@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!

FAQs

Package last updated on 17 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts