npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@collinsadi/swagger

v1.0.2

Published

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.

Downloads

12

Readme

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