Skip to main content

Raw node:http

Dhal can run without Express or Fastify.

import http from "node:http";
import { createNodeHttpDhal } from "@rokadhq/dhal/node-http";

const dhal = createNodeHttpDhal();

const server = http.createServer(async (req, res) => {
const decision = await dhal.inspect(req, res);

if (decision.action === "block") {
return;
}

res.end("ok");
});

server.listen(3000);

When to use this adapter

Use raw node:http when you are building your own server abstraction, a minimal API runtime, or an internal gateway.

Body inspection

Raw Node requests do not automatically parse JSON bodies. If body-level rules are important, parse and pass body data through your integration layer.