Skip to content

Mounting apps

Hamur mounts other apps inside itself, and runs inside other apps. This page says which preset can do which; the guide for each piece is in Server.

Other apps inside Hamur

You haveUseRuns onGuide
a Hono app, a Workers module, any { fetch(request, env, ctx) }fromWebHandler(app, { base? }) in a raw handler with method: "*"every preset that has a serverMount a fetch app
an Express or Connect app, any (req, res, next) middlewarefromNodeHandler(handler) in a raw handler with method: "*"presets whose serverTarget is bun or nodeRun an Express or Connect handler
a site you are moving over one page at a timeserver.fallbackProxy: "https://old.example.com"every preset that has a serverFall back to another server

fromNodeHandler needs node:http. On the presets that build for the browser target (cloudflare, cloudflare-pages, netlify-edge, standard, lambda-edge, zephyr and vercel with vercel.runtime: "edge") the build fails and names the route: fromNodeHandler in server/legacy.ts#legacy needs a node or bun preset; the "cloudflare" preset has no node:http.

server.fallbackProxy forwards a request that matches no public file, no handler route and no page, as a proxy route rule forwards, so it follows the same rules for headers, redirects and an unreachable origin (502). The static family has no server to forward from and lists server.fallbackProxy among the features it drops. With node-middleware and middleware({ fallthrough: true }), the proxy is tried before next(). In the browser, a Link to a path that no concrete page matches is a full page load, since that page may live on the old server.

The signatures are in the API reference: fromWebHandler and fromNodeHandler. The sample files are Mount a fetch app and the fallback proxy config.

Hamur inside other apps

You runUsePage
a Node server of your own (Express, Fastify, Hono on Node, h3)--preset node-middleware: import middleware or handler from the entryNode middleware
a host that calls a fetch export (a Worker runtime, Deno, a Bun script)--preset standard: export default { fetch(request, ctx?) }Standard
a Bun or Node script that starts and stops the server itselffetch and listen of the bun and node entryServer entry exports
another Worker that calls this onea service binding with createFetch({ binding })Service bindings