Files
tower/apps/web/app/api/routes/[id]/route.ts
T

12 lines
412 B
TypeScript

const API_URL = process.env.API_URL ?? 'http://localhost:3001';
export async function DELETE(
_req: Request,
{ params }: { params: Promise<{ id: string }> },
) {
const { id } = await params;
const res = await fetch(`${API_URL}/routes/${id}`, { method: 'DELETE' });
if (res.status === 204) return new Response(null, { status: 204 });
return Response.json(await res.json(), { status: res.status });
}