# orca.web.page

> A module of morca's API.

What a handler answers, `Page`: its status, its JSON and its HTML, where to send a browser, and `respond`, which sends it: the HTML, or the JSON to a script; a fragment or a file as itself, whatever was asked for.

## Structs

### `Page`

```mojo
struct Page
```

What a handler answers: a page, its JSON, a fragment or a file, or where to go.

Implements: `Movable`

Fields:

- `status: Int`
- `json: String`
- `html: String`
- `content_type: String`: Set for what isn't a page or its JSON (a fragment, a file): `html` is sent as this, whatever was asked for.
- `location: String`: Set for an action that was done: a browser is sent there with 303, and a script gets `json` with 200.
- `poll_every: Int`: Set for a live fragment: the seconds until the page asks again, sent as `X-Poll-Every` (`_POLL`).
- `here: String`: Where a login link on it comes back to; empty for its own URL.
- `headers: List[Tuple[String, String]]`: More headers to send: a cookie, `WWW-Authenticate`.

#### `__init__`

```mojo
def __init__(out self, status: Int, var json: String, var html: String, content_type: String = "", location: String = "", poll_every: Int = Int(0))
```

## Functions

### `respond`

```mojo
def respond(page: Page, json: Bool) -> Response
```
