Serves the categories dumps and playlists are filed under, a set for each kind, and changes them for those with category:manage. A dump category's feed is GET /api/dumps?category=:slug, a playlist category's GET /api/playlists?category=:slug.

  • GET /api/categories — public. Answers every category of both kinds, by kind, then in order.
  • POST /api/categories — permission category:manage. Creates a category of the kind it names.
  • PUT /api/categories/:id — permission category:manage. Updates a category.
  • DELETE /api/categories/:id — permission category:manage. Deletes a category; its dumps or playlists stay.

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/categories.ts";