No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.jshintignore
.jshintrc
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

express-climber

Build Status Coverage Status

npm install --save express-climber

This package aims to list all your routes declared in a Router or in an Application. It is tested with express at version 4.13.3. Please tell me if with another version this module fails. Middleware or router handler have a name, a description and a long_description. The name is the function name. To fill description and long_description, add those properties to the function like this:

function myHandle(req, res) {
  ...
}
myHandle.description = 'This is the description';
myHandle.long_description = 'This is the long description where you can describe better the behaviour for this handler.';

If you want to hide a middleware, add hideInClimber property to the function like this:

function myMiddleware(req, res, next) {
  ...
}
myMiddleware.hideInClimber = true;

And myMiddleware will be not listed.

getAsStructure

Return a complex structure. In the structure the keys are the routes and the values are a description of what is attached there Example of output:

{
  '/': {
    get: { middlewares: [ ... ] },
    post: { middlewares: [ ... ] },
    put: { middlewares: [ ... ] },
    delete: { middlewares: [ ... ] }
  },
  '/foo': {
    get: { handle: { ... }, middlewares: [ ... ] },
    post: { handle: { ... }, middlewares: [ ... ] }
  }
}

See the tests for more informations.

getAsArray

This returns na array that contains all routes defined. Example of output:

[
  {
    method: 'get',
    middlewares: [ ... ],
    handle: { ... },
    url: '/foo'
  },
  {
    method: 'post',
    middlewares: [ ... ],
    handle: { ... },
    url: '/foo'
  },
  {
    method: 'delete',
    middlewares: [ ... ],
    handle: { ... },
    url: '/bar'
  }
]

Contributing

Any suggestion are accepted. Please open an issue or make a PR.