Skip to main content
Concepts

Route requests

Mount direct app traffic and the private Rivet callback on a Hono server.

The package root exports one router. Mount ordinary application traffic at any prefix and forward the private /api/rivet/* callback to the same router:

import { appsRouter } from "@rivet-dev/dynamic-apps";
import { Hono } from "hono";

const server = new Hono();

server.all("/api/rivet/*", (c) => appsRouter.fetch(c.req.raw));
server.route("/apps", appsRouter);

This serves /:appId/* relative to the mount. For example, /apps/example/api/items?q=1 reaches the deployed handler as /api/items?q=1. A bare /apps/example request redirects to /apps/example/.