## Router


A synchronous HTTP router.


Usage

``` python
Router(
    prefix="",
    deps=None,
)
```


## Parameters


`prefix: str = ``""`  
URL prefix for all routes.

`deps: dict | None = None`  
Dependency injection mapping.


## Methods

| Name | Description |
|----|----|
| [get()](#get) | Register a GET route. |
| [post()](#post) | Register a POST route. |
| [static()](#static) | Serve static files. |
| [use()](#use) | Add middleware to the router. |

------------------------------------------------------------------------


#### get()


Register a GET route.


Usage

``` python
get(path, handler=None)
```


##### Parameters


`path: str`  
URL path pattern.

`handler=None`  
Request handler callable.


------------------------------------------------------------------------


#### post()


Register a POST route.


Usage

``` python
post(path, handler=None)
```


##### Parameters


`path: str`  
URL path pattern.

`handler=None`  
Request handler callable.


------------------------------------------------------------------------


#### static()


Serve static files.


Usage

``` python
static(url_path, dir_path)
```


##### Parameters


`url_path: str`  
URL prefix for static files.

`dir_path: str`  
Local directory path.


------------------------------------------------------------------------


#### use()


Add middleware to the router.


Usage

``` python
use(middleware)
```


##### Parameters


`middleware`  
Middleware callable.
