add importing feed ids

This commit is contained in:
ld3zian 2025-02-13 17:12:57 -07:00
parent ced8f26537
commit b614d9fb3f
2 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,28 @@
import type { APIRoute } from "astro";
import { getFeedMapping } from '../../../lib/db';
export const GET: APIRoute = async ({ params }) => {
const { feedId } = params;
if (!feedId) {
return new Response("Feed ID not provided", { status: 400 });
}
try {
const mapping = await getFeedMapping(feedId);
if (!mapping) {
return new Response("Feed not found", { status: 404 });
}
return new Response(JSON.stringify(mapping), {
status: 200,
headers: {
'Content-Type': 'application/json'
}
});
} catch (error) {
console.error('Error fetching feed:', error);
return new Response("Internal server error", { status: 500 });
}
};