Class: Router#

server.Router

A simple router.

Constructors#

constructor#

new Router()

Properties#

_add#

Private _add: any

Add a new route.

param The method

param The pattern

param The callback

Defined in#

packages/server/lib/router.d.ts:59


_routes#

Private _routes: any

Defined in#

packages/server/lib/router.d.ts:60

Methods#

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/lib/router.d.ts:45


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/lib/router.d.ts:13


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/lib/router.d.ts:37


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/lib/router.d.ts:29


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/lib/router.d.ts:21


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/lib/router.d.ts:51