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

express-route-lister

v1.0.2

Published

A simple npm package that lists all the routes available in an Express application.

Downloads

4

Readme

express-route-lister

A simple npm package that lists all the routes available in an Express application.

Installation

You can install the package globally or use npx to run it directly without installation.

To install globally, run:

npm install -g express-route-lister

To run it using npx:

npx express-route-lister

Usage

Make sure you are in the root directory of your Express application before running the package.

Once the package is running, you can access the list of routes by visiting http://localhost:3000 in your browser (assuming the default port is used).

The response will be a JSON object containing the routes available in your Express application, along with the HTTP methods supported by each route.

Example

const express = require('express');
const app = express();

app.get('/users', (req, res) => {
  // Get all users
});

app.post('/users', (req, res) => {
  // Create a new user
});

app.put('/users/:id', (req, res) => {
  // Update a user by ID
});

// ... other routes ...

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server started on port ${PORT}`);
});



Running the express-route-lister package will result in the following response:

[
  {
    "path": "/users",
    "methods": ["GET", "POST"]
  },
  {
    "path": "/users/:id",
    "methods": ["PUT"]
  }
  // ... other routes ...
]

The response shows that the Express application has two routes: /users supporting the HTTP methods GET and POST, and /users/:id supporting the PUT method.

Dependencies

This package relies on the following dependencies:

  • Express: A fast and minimalist web framework for Node.js.
  • Chalk: A library for adding color to the terminal output.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.

License

This package is licensed under the MIT License.

Acknowledgments

This package was inspired by the need to easily list routes in an Express application. That's it! Customize the documentation as per your requirements, and make sure to update the URLs and repository information accordingly.