MCPcopy Create free account
hub / github.com/9d8dev/directory / POST

Function POST

app/api/bookmarks/route.ts:18–53  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

16}
17
18export async function POST(request: Request) {
19 try {
20 const body = await request.json();
21
22 // Insert the new bookmark
23 await db.insert(bookmarks).values({
24 url: body.url,
25 title: body.title,
26 slug: body.slug,
27 description: body.description || null,
28 categoryId: body.categoryId || null,
29 overview: body.overview || null,
30 favicon: body.favicon || null,
31 screenshot: body.screenshot || null,
32 ogImage: body.ogImage || null,
33 ogTitle: body.ogTitle || null,
34 ogDescription: body.ogDescription || null,
35 notes: body.notes || null,
36 tags: body.tags || null,
37 isArchived: body.isArchived || false,
38 isFavorite: body.isFavorite || false,
39 search_results: body.search_results || null,
40 });
41
42 return NextResponse.json(
43 { message: "Bookmark created successfully" },
44 { status: 201 },
45 );
46 } catch (error) {
47 console.error("Error creating bookmark:", error);
48 return NextResponse.json(
49 { error: "Failed to create bookmark" },
50 { status: 500 },
51 );
52 }
53}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected