Licence
MIT
Version
2.3.1
Deps
0
Size
10 kB
Vulns
0
Weekly
2.2K
@fedify/h3: Integrate Fedify with h3
This package provides a simple way to integrate Fedify with h3, an HTTP server framework behind Nitro, Analog, Vinxi, SolidStart, TanStack Start, and other many web frameworks.
The integration code looks like this:
import { createApp, createRouter } from "h3";
import { integrateFederation, onError } from "@fedify/h3";
import { federation } from "./federation"; // Your `Federation` instance
export const app = createApp({ onError });
app.use(
integrateFederation(
federation,
(event, request) => "context data goes here"
)
);
const router = createRouter();
app.use(router);Your app has to configure
onErrorto let Fedify negotiate content types. If you don't do this, Fedify will not be able to respond with a proper error status code when a content negotiation fails.