@kamalyb/express-list-routes
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "@kamalyb/express-list-routes", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Typescript'd fork of express-list-routes", | ||
@@ -19,3 +19,4 @@ "types": "./dist/index.d.ts", | ||
"build": "rimraf dist && tsc", | ||
"test": "jest" | ||
"test": "jest", | ||
"publish": "git add . && git commit -m \"updates\" && npm version patch && yarn build && npm publish" | ||
}, | ||
@@ -22,0 +23,0 @@ "repository": { |
# express-list-routes | ||
List all routes used in Express[3,4,5] | ||
A typescript'd fork of [express-list-routes](https://github.com/labithiotis/express-list-routes) solely as a result of personal need | ||
[![NPM Version][npm-image]][npm-url] | ||
[![NPM Downloads][downloads-image]][downloads-url] | ||
**Example App** | ||
**Example App** | ||
```js | ||
const express = require('express'); | ||
const expressListRoutes = require('express-list-routes'); | ||
import express, { Express } from "express"; | ||
import expressListRoutes from "@kamalyb/express-list-routes"; | ||
const app = express(); | ||
const app: Express = express(); | ||
app.get('/health', fn) | ||
app.get("/health", fn); | ||
app.use('/admin', router); | ||
router.route('/user') | ||
.post(fn) | ||
.get(fn) | ||
.put(fn); | ||
``` | ||
app.use("/admin", router); | ||
router.route("/user").post(fn).get(fn).put(fn); | ||
``` | ||
**List all Routes with prefix** | ||
```js | ||
expressListRoutes(app, { prefix: '/api/v1' }); | ||
expressListRoutes(app, { prefix: "/api/v1" }); | ||
// Logs out the following: | ||
@@ -32,3 +29,5 @@ // GET /api/v1/health | ||
``` | ||
**Or only log out nested router routes** | ||
```js | ||
@@ -45,3 +44,4 @@ expressListRoutes(router); | ||
```bash | ||
npm install express-list-routes | ||
npm install @kamalyb/express-list-routes | ||
yarn add @kamalyb/express-list-routes | ||
``` | ||
@@ -60,4 +60,6 @@ | ||
## Migrations | ||
## Migrations | ||
### 0.1 -> 1.0 | ||
The order of the params have changed, and dropped support for freeform text. | ||
@@ -67,7 +69,7 @@ | ||
```expressListRoutes({ prefix: '/api/v1' }, 'API:', router);``` | ||
`expressListRoutes({ prefix: '/api/v1' }, 'API:', router);` | ||
**AFTER 1.0+** | ||
```expressListRoutes(router, { prefix: '/api/v1' });``` | ||
`expressListRoutes(router, { prefix: '/api/v1' });` | ||
@@ -74,0 +76,0 @@ [npm-image]: https://img.shields.io/npm/v/express-list-routes.svg?style=flat |
17948
80