百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

route-list

> 后端框架
开源

在 CLI 中美观地显示 Express/Koa/Hapi/Fastify 路由。

385 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

在 CLI 中美观地显示 Express/Koa/Hapi/Fastify 路由。

route-list

✨ Beautifully shows Express/Koa/Hapi/Fastify routes in CLI.

Installation

bash
# Installs the package so it's globally accessible in terminal
npm i route-list -g

Configuration

Before you can use route-list on your project, we first need to make sure it's configured properly. In order for route-list to work, we need to export server "app". The example below is for Express but it also applies to Koa (with @koa/router)/Hapi/Fastify.

app.js / app.ts

javascript
const app = express();

app.get('/', (req, res) => res.sendStatus(200));
app.get('/products', (req, res) => res.sendStatus(200));
app.get('/products/:id', (req, res) => res.sendStatus(200));

// CJS
// Option 1: module.exports = app;
// Option 2: module.exports = { app, yourOtherExports... };
// Option 3: module.exports = functionThatReturnsApp;

// ESM
// Option 1: export default app;
// Option 2: export default { app, yourOtherExports... };
// Option 3: export default functionThatReturnsApp;

NOTE: In case you use SocketIO with Express, make sure to export Express app, not http.createServer server instance.

☁️ Usage

Options

  • -g, --group - Display routes in groups separated with new line
  • -m, --methods - Include routes registered for HTTP method(s)
  • -i, --include-paths - Include routes starting with path(s)
  • -e, --exclude-paths - Exclude routes starting with path(s)

Examples

bash
route-list server/app.js
bash
route-list --group server/app.js
bash
route-list --methods GET,POST server/app.js

NOTE: In case an app is part of NX monorepo, make sure to build it first.

Programmatic Usage

javascript
import RouteList from 'route-list';

// Example result { "/": ["GET"], "/users": ["GET", "POST"] }
const routesMap = RouteList.getRoutes(app, 'express');

// Print routes to console
RouteList.printRoutes(routesMap);

Author

Vladimir Mikulic

  • Twitter: @VladoDev
  • Github: @VladimirMikulic
  • LinkedIn: @vladimirmikulic

Contributing

Contributions, issues and feature requests are welcome!

Credits

The project was inspired by new route:list command in Laravel 9. New route:list itself was inspired by pretty-routes project. Big thanks to Λlex Wulf for building pretty-routes and Laravel community for recognizing the usefulness of the project.

✏️ License

This project is licensed under MIT license.

‍ Show your support

Give a ⭐️ if this project helped you!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptcommand-line-toolexpressjsfastifyhapi

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架