19 lines
557 B
TypeScript
19 lines
557 B
TypeScript
import { Handlers } from "$fresh/server.ts";
|
|
import { db } from "../../../../databases/db.ts";
|
|
import { ues } from "../../../../databases/schema.ts";
|
|
|
|
export const handler: Handlers = {
|
|
async GET() {
|
|
try {
|
|
const result = await db.select().from(ues);
|
|
|
|
return new Response(JSON.stringify(result), {
|
|
status: 200,
|
|
headers: { "Content-Type": "application/json" },
|
|
});
|
|
} catch (error) {
|
|
console.error("Error fetching UEs:", error);
|
|
return new Response("Failed to fetch data", { status: 500 });
|
|
}
|
|
},
|
|
}; |