Serves the comments on dumps. Comments are broadcast over the WebSocket as they are posted, edited and deleted, to everyone, or to its poster alone for a private dump, whose comments 404 for anyone else.

  • GET /api/dumps/:dumpId/comments — optional sign-in. Answers every comment on a dump, oldest first.
  • POST /api/dumps/:dumpId/comments — signed in. Posts a comment, replying to parentId if given.
  • PATCH /api/comments/:commentId — signed in, as its author or with comment:moderate. Edits a comment.
  • GET /api/comments/:commentId/likers?page=&limit= — optional sign-in. Answers a page of the users who like a comment.
  • DELETE /api/comments/:commentId — signed in, as its author or with comment:moderate. Deletes a comment, leaving its place in the thread.

Variables

v
default: Router

Mounted by api/main.ts behind the error, Open Graph and CORS middleware. An APIException thrown by a handler becomes the JSON error response there.

Usage

import * as mod from "api/routes/comments.ts";