Fastify
Run Fuma Comment on Fastify
Setup
Register the comment plugin on your Fastify app.
import Fastify from "fastify";
import { commentPlugin } from "@fuma-comment/server/fastify";
const app = Fastify();
await app.register(
commentPlugin({
storage, // storage adapter
auth, // auth adapter
}),
);
await app.listen({ port: 3000 });Routes are registered at /comments/:page and related paths by default.
Custom base URL
Use baseUrl to mount routes under a prefix (e.g. /api/comments/:page):
await app.register(
commentPlugin({
storage,
auth,
baseUrl: "api",
}),
);Direct registration
Alternatively, pass your Fastify instance to FastifyComment:
import { FastifyComment } from "@fuma-comment/server/fastify";
FastifyComment({
app,
storage,
auth,
});