Class: Router#

@jupyterlite/server.Router

A simple router.

Constructors#

constructor#

new Router()

Properties#

_routes#

Private _routes: IRoute[] = []

Defined in#

packages/server/src/router.ts:125

Methods#

_add#

Private _add(method, pattern, callback): void

Add a new route.

Parameters#

Name

Type

Description

method

Method

The method

pattern

string | RegExp

The pattern

callback

Callback

The callback

Returns#

void

Defined in#

packages/server/src/router.ts:110

delete#

delete(pattern, callback): void

Add a new DELETE route

Parameters#

Name

Type

Description

pattern

string | RegExp

The pattern to match

callback

Callback

The function to call on pattern match

Returns#

void

Defined in#

packages/server/src/router.ts:58

get#

get(pattern, callback): void

Add a new GET route

Parameters#

Name

Type

Description

pattern

string | RegExp

The pattern to match

callback

Callback

The function to call on pattern match

Returns#

void

Defined in#

packages/server/src/router.ts:14

patch#

patch(pattern, callback): void

Add a new PATCH route

Parameters#

Name

Type

Description

pattern

string | RegExp

The pattern to match

callback

Callback

The function to call on pattern match

Returns#

void

Defined in#

packages/server/src/router.ts:47

post#

post(pattern, callback): void

Add a new POST route

Parameters#

Name

Type

Description

pattern

string | RegExp

The pattern to match

callback

Callback

The function to call on pattern match

Returns#

void

Defined in#

packages/server/src/router.ts:36

put#

put(pattern, callback): void

Add a new PUT route

Parameters#

Name

Type

Description

pattern

string | RegExp

The pattern to match

callback

Callback

The function to call on pattern match

Returns#

void

Defined in#

packages/server/src/router.ts:25

route#

route(req): Promise<Response>

Route a request.

Parameters#

Name

Type

Description

req

Request

The request to route.

Returns#

Promise<Response>

Defined in#

packages/server/src/router.ts:67