mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 20:23:45 -07:00
add importing feed ids
This commit is contained in:
parent
ced8f26537
commit
b614d9fb3f
2 changed files with 106 additions and 1 deletions
28
src/pages/api/feed/[feedId].ts
Normal file
28
src/pages/api/feed/[feedId].ts
Normal 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 });
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue