# Class: `Router` [@jupyterlite/server](../modules/jupyterlite_server.md).Router A simple router. ## Constructors ### `constructor` > > **`new Router`**() ## Properties ### `_routes` > > `Private` **`_routes`**: [`IRoute`](../interfaces/jupyterlite_server.Router.IRoute.md)[] = `[]` #### Defined in [packages/server/src/router.ts:125](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L125) ## Methods ### `_add` > > `Private` **`_add`**(`method`, `pattern`, `callback`): `void` Add a new route. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `method` | [`Method`](../modules/jupyterlite_server.Router.md#method) | The method | | `pattern` | `string` \| `RegExp` | The pattern | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The callback | #### Returns `void` #### Defined in [packages/server/src/router.ts:110](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L110) ### `delete` > > **`delete`**(`pattern`, `callback`): `void` Add a new DELETE route #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `pattern` | `string` \| `RegExp` | The pattern to match | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The function to call on pattern match | #### Returns `void` #### Defined in [packages/server/src/router.ts:58](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L58) ### `get` > > **`get`**(`pattern`, `callback`): `void` Add a new GET route #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `pattern` | `string` \| `RegExp` | The pattern to match | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The function to call on pattern match | #### Returns `void` #### Defined in [packages/server/src/router.ts:14](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L14) ### `patch` > > **`patch`**(`pattern`, `callback`): `void` Add a new PATCH route #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `pattern` | `string` \| `RegExp` | The pattern to match | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The function to call on pattern match | #### Returns `void` #### Defined in [packages/server/src/router.ts:47](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L47) ### `post` > > **`post`**(`pattern`, `callback`): `void` Add a new POST route #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `pattern` | `string` \| `RegExp` | The pattern to match | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The function to call on pattern match | #### Returns `void` #### Defined in [packages/server/src/router.ts:36](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L36) ### `put` > > **`put`**(`pattern`, `callback`): `void` Add a new PUT route #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `pattern` | `string` \| `RegExp` | The pattern to match | | `callback` | [`Callback`](../modules/jupyterlite_server.Router.md#callback) | The function to call on pattern match | #### Returns `void` #### Defined in [packages/server/src/router.ts:25](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L25) ### `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](https://github.com/jupyterlite/jupyterlite/blob/6de9813/packages/server/src/router.ts#L67)