Functions

routes()

Returns an array with the routes that were defined.

router.routes();

middlewares()

Returns an array with the middlewares that were defined.

router.middlewares();

getRouteParams(route, path)

A method that is not part of the Router class and is used to get the parameters of a URL.

Parameter

Type

Description

route

String

Route with dynamic parameters

path

String

The url that was invoked by the user

Example:

const params = getRouteParams("/users/:id/:username", "/users/1/admin");
// return { id: 1, username: "admin" }

Last updated

Was this helpful?