Primate
Guides Components

Use HTML

Add HTML templates with the @primate/html module.

1) Install

Install the Primate HTML package.

$ npm install @primate/html

2) Configure

Load the HTML module in your configuration.

TypeScriptconfig/app.ts
import html from "@primate/html";
import config from "primate/config";

export default config({ modules: [html()] });

3) Write a template

Compose a template in HTML.

HTMLcomponents/Welcome.html
<h1>Hello, World!</h1>

4) Render the template

Use response.view in a route to render the template.

TypeScriptroutes/index.ts
import response from "primate/response";
import route from "primate/route";

route.get(() => response.view("Welcome.html"));