drivers api endpoint created
This commit is contained in:
committed by
GitHub
parent
945a1b96e0
commit
c5c50e75db
@@ -0,0 +1,15 @@
|
||||
import { neon } from "@neondatabase/serverless";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const sql = neon(process.env.DATABASE_URL!);
|
||||
|
||||
const response = await sql`SELECT * FROM drivers`;
|
||||
|
||||
return Response.json({ data: response });
|
||||
} catch (error) {
|
||||
console.log("[GET_DRIVERS]: ", error);
|
||||
|
||||
return Response.json({ error }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user