Add API routes
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import { prisma } from '$lib/db';
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
const categories = await prisma.proclamationCategory.findMany()
|
||||
return new Response(JSON.stringify(categories))
|
||||
}
|
||||
@@ -17,11 +17,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||
throw error(500, 'unable to fetch proclamations');
|
||||
}
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
proclamations
|
||||
})
|
||||
);
|
||||
return new Response(JSON.stringify(proclamations));
|
||||
}
|
||||
|
||||
// Check that the key exists
|
||||
|
||||
Reference in New Issue
Block a user