feat: add admin tags and albums APIs
This commit is contained in:
17
apps/web/app/api/albums/route.ts
Normal file
17
apps/web/app/api/albums/route.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getAdminOk, handleCreateAlbum, handleListAlbums } from "./handlers";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET(request: Request): Promise<Response> {
|
||||
const res = await handleListAlbums({ adminOk: getAdminOk(request.headers) });
|
||||
return Response.json(res.body, { status: res.status });
|
||||
}
|
||||
|
||||
export async function POST(request: Request): Promise<Response> {
|
||||
const bodyJson = await request.json().catch(() => ({}));
|
||||
const res = await handleCreateAlbum({
|
||||
adminOk: getAdminOk(request.headers),
|
||||
body: bodyJson,
|
||||
});
|
||||
return Response.json(res.body, { status: res.status });
|
||||
}
|
||||
Reference in New Issue
Block a user