25 lines
687 B
TypeScript
25 lines
687 B
TypeScript
// app/api/turn14/token/route.ts
|
|
export async function POST(req: Request) {
|
|
const body = await req.json();
|
|
|
|
const upstream = await fetch('https://turn14.data4autos.com/v1/auth/token', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify(body),
|
|
});
|
|
|
|
const contentType = upstream.headers.get('content-type') ?? 'application/json';
|
|
const buf = await upstream.arrayBuffer();
|
|
|
|
return new Response(buf, {
|
|
status: upstream.status,
|
|
headers: { 'content-type': contentType },
|
|
});
|
|
}
|
|
|
|
export async function GET() {
|
|
return new Response(JSON.stringify({ ok: true }), {
|
|
headers: { 'content-type': 'application/json' },
|
|
});
|
|
}
|