feat(app): remove backend
This commit is contained in:
parent
8a24572cd2
commit
217736d05a
145 changed files with 3546 additions and 10516 deletions
15
src/app/api/chats/route.ts
Normal file
15
src/app/api/chats/route.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import db from '@/lib/db';
|
||||
|
||||
export const GET = async (req: Request) => {
|
||||
try {
|
||||
let chats = await db.query.chats.findMany();
|
||||
chats = chats.reverse();
|
||||
return Response.json({ chats: chats }, { status: 200 });
|
||||
} catch (err) {
|
||||
console.error('Error in getting chats: ', err);
|
||||
return Response.json(
|
||||
{ message: 'An error has occurred.' },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue