Class: Router#
@jupyterlite/server.Router
A simple router.
Constructors#
constructor#
new Router()
Properties#
_routes#
Private_routes:IRoute[] =[]
Defined in#
Methods#
_add#
Private_add(method,pattern,callback):void
Add a new route.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
The method |
|
|
|
The pattern |
|
The callback |
Returns#
void
Defined in#
delete#
delete(pattern,callback):void
Add a new DELETE route
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The pattern to match |
|
The function to call on pattern match |
Returns#
void
Defined in#
get#
get(pattern,callback):void
Add a new GET route
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The pattern to match |
|
The function to call on pattern match |
Returns#
void
Defined in#
patch#
patch(pattern,callback):void
Add a new PATCH route
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The pattern to match |
|
The function to call on pattern match |
Returns#
void
Defined in#
post#
post(pattern,callback):void
Add a new POST route
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The pattern to match |
|
The function to call on pattern match |
Returns#
void
Defined in#
put#
put(pattern,callback):void
Add a new PUT route
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The pattern to match |
|
The function to call on pattern match |
Returns#
void
Defined in#
route#
route(req):Promise<Response>
Route a request.
Parameters#
Name |
Type |
Description |
|---|---|---|
|
|
The request to route. |
Returns#
Promise<Response>