Servers add & get_all api route | networks api route

This commit is contained in:
headlessdev
2025-06-01 15:14:52 +02:00
parent 2e73acdeba
commit ed4a607373
3 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { NextRequest, NextResponse } from "next/server";
import prisma from "@/app/prisma";
export async function GET(request: NextRequest) {
try {
const networks = await prisma.network.findMany({
orderBy: {
name: 'asc',
},
});
return NextResponse.json({ networks }, { status: 200 });
} catch (error: any) {
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
}
}