Router
Router is the class of the framework that handles routing and middleware registration.
Constructor
This section is empty.
Properties
This section is empty.
Methods
use
Signature:
use(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles requests of any method.
get
Signature:
get(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles GET requests.
head
Signature:
head(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles HEAD requests.
post
Signature:
post(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles POST requests.
put
Signature:
put(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles PUT requests.
patch
Signature:
patch(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles PATCH requests.
delete
Signature:
delete(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles DELETE requests.
options
Signature:
options(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles OPTIONS requests.
connect
Signature:
connect(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles CONNECT requests.
trace
Signature:
trace(path?: string, handler: RequestHandler | Router): Router
where
path
:string | undefined
— optional request pathhandler
:RequestHandler | Router
— handler for the incoming request
Adds middleware that handles TRACE requests.