Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Callable

Index

Properties

all: IRouterMatcher<IRouter, "all">

Special-cased "all" method, applying the given route path, middleware, and callback to every HTTP method.

checkout: IRouterMatcher<IRouter, any>
connect: IRouterMatcher<IRouter, any>
delete: IRouterMatcher<IRouter, "delete">
get: IRouterMatcher<IRouter, "get">
head: IRouterMatcher<IRouter, "head">
m-search: IRouterMatcher<IRouter, any>
merge: IRouterMatcher<IRouter, any>
mkactivity: IRouterMatcher<IRouter, any>
mkcol: IRouterMatcher<IRouter, any>
notify: IRouterMatcher<IRouter, any>
options: IRouterMatcher<IRouter, "options">
patch: IRouterMatcher<IRouter, "patch">
post: IRouterMatcher<IRouter, "post">
propfind: IRouterMatcher<IRouter, any>
proppatch: IRouterMatcher<IRouter, any>
purge: IRouterMatcher<IRouter, any>
put: IRouterMatcher<IRouter, "put">
report: IRouterMatcher<IRouter, any>
search: IRouterMatcher<IRouter, any>
stack: any[]

Stack of configured routes

subscribe: IRouterMatcher<IRouter, any>
trace: IRouterMatcher<IRouter, any>
unlock: IRouterMatcher<IRouter, any>
unsubscribe: IRouterMatcher<IRouter, any>

Methods

  • Map the given param placeholder name(s) to the given callback(s).

    Parameter mapping is used to provide pre-conditions to routes which use normalized placeholders. For example a :user_id parameter could automatically load a user's information from the database without any additional code,

    The callback uses the samesignature as middleware, the only differencing being that the value of the placeholder is passed, in this case the id of the user. Once the next() function is invoked, just like middleware it will continue on to execute the route, or subsequent parameter functions.

     app.param('user_id', function(req, res, next, id){
    User.find(id, function(err, user){
    if (err) {
    next(err);
    } else if (user) {
    req.user = user;
    next();
    } else {
    next(new Error('failed to load user'));
    }
    });
    });

    Parameters

    Returns IRouter

  • Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()

    deprecated

    since version 4.11

    Parameters

    Returns IRouter

  • Type parameters

    • T: string

    Parameters

    • prefix: T

    Returns IRoute<T>

  • Parameters

    Returns IRoute<string>