DE
Beta-Übersetzung

@core / comments

1.0.1 ▾
verifiziertMIT
GitHub

Moderierte Kommentare zu allem: Gast oder Konto, Antworten, Bewertung 1–5, Sperren, DSGVO-Löschung, sicheres HTML

Code9 DateienKontext~552 TokensPrüfung bestanden

Der genaue Baum, der nach .genpmignore eingebunden wird. Gepinnt an

src/lib/comments/adapters/next.tsschreibgeschützt · abfbbe8
// Adaptador Next.js: `app/api/comments/[type]/[id]/route.ts` →
//   export const { GET, POST } = commentRoute({ currentUser: async () => getUser(await cookies()) });
import type { Moderation } from '../index.ts';
import { type CurrentUser, handleList, handlePost } from './http.ts';

type Ctx = { params: Promise<{ type: string; id: string }> };

export function commentRoute(opts: { currentUser: CurrentUser; moderation?: Moderation }) {
  return {
    GET: async (req: Request, ctx: Ctx) => {
      const { type, id } = await ctx.params;
      return handleList(req, type, id);
    },
    POST: async (req: Request, ctx: Ctx) => {
      const { type, id } = await ctx.params;
      return handlePost(req, type, id, opts);
    },
  };
}

@core/comments melden

Melde dich mit GitHub an, um ein Paket zu melden.