A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
[API] Add the GET /api/v1/links api
MohamedBasseme5b79e8ff0de
diff --git a/app/api/v1/links/route.ts b/app/api/v1/links/route.tsindex 9103830b..9a1de10a 100644--- a/app/api/v1/links/route.ts+++ b/app/api/v1/links/route.ts@@ -26,3 +26,27 @@ export async function POST(request: NextRequest) {return NextResponse.json(link, { status: 201 });}++export async function GET() {+ // TODO: We probably should be using an API key here instead of the session;+ const session = await getServerSession(authOptions);+ if (!session) {+ return new Response(null, { status: 401 });+ }+ const links = await prisma.bookmarkedLink.findMany({+ where: {+ userId: session.user.id,+ },+ include: {+ details: {+ select: {+ title: true,+ description: true,+ imageUrl: true,+ }+ },+ }+ })++ return NextResponse.json({links});+}