> For the complete documentation index, see [llms.txt](https://stricjs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stricjs.gitbook.io/docs/basic/sending-html.md).

# Sending HTML

Return HTML as a response

For convenient, `@stricjs/utils` provides the `html` method to send HTML response.

```typescript
import { Router } from '@stricjs/router';
import { html } from '@stricjs/utils';

const page = `<html>
    <body>
        <h1>Hi</h1>
    <body>
</html>`;

export default new Router()
    .get('/', () => html(page));
```

If you want to add additional properties to the response init, create your own `html` function.

```typescript
import { Router } from '@stricjs/router';
import { createHTML } from '@stricjs/utils';

const html = createHTML({ status: 404 });

const page = `<html>
    <body>
        <h1>Page not found</h1>
    <body>
</html>`;

export default new Router()
    .get('/404', () => html(page));
```

You can set the HTML content you want to send as well.

```typescript
import { Router } from '@stricjs/router';
import { createHTML } from '@stricjs/utils';

// Call this with no args
const html = createHTML({ status: 404 }, `<html>
    <body>
        <h1>Page not found</h1>
    <body>
</html>`);

export default new Router()
    .get('/404', html);
```
