Skip to main content

Fastify

Install:

npm install fastify @rokadhq/dhal

Register the plugin:

import Fastify from "fastify";
import { dhalFastify } from "@rokadhq/dhal/fastify";

const app = Fastify();

await app.register(dhalFastify());

app.get("/", async () => ({ ok: true }));

await app.listen({ port: 3000 });

Config file

By default, Dhal looks for dhal.json in the current working directory.

npx dhal init
npx dhal test-config

Route profiles

Fastify apps should use route-specific policies for sensitive endpoints such as login, upload, and admin surfaces.