Загрузка…
Загрузка…
Edge идеален для geo + fetch; Node APIs и raw TCP DB — build failure.
// app/api/geo/route.ts — a perfect Edge use case: pure I/O + geo-awareness
export const runtime = 'edge';
export async function GET(req: Request) {
// Geo headers are injected by the edge network — free, no lookup
const country = req.headers.get('x-vercel-ip-country') ?? 'US';
// ✅ Web fetch to an HTTP data source — no TCP pool, no Node driver
const res = await fetch(` {
next: { revalidate: 60 }, // cached at the edge for 60s
});
return Response.json(await res.json());
}// ❌ This will NOT build on the Edge runtime
export const runtime = 'edge';
import fs from 'node:fs'; // no filesystem in an isolate
import { Client } from 'pg'; // raw TCP driver — connection storm
export async function GET() {
const tpl = fs.readFileSync('./email.html'); // throws
// ...
}Edge route = fetch + geo headers; fs и pg Client — типичный ❌ на собеседовании.
