Next.js 开发商 Vercel 正式推出 Edge Functions
Next.js 框架背后的开发商 Vercel 宣布推出 Edge Functions,现已面向所有客户全面推出 (GA)。 根据介绍,Vercel Edge Functions 是 JavaScript、TypeScript 或 WebAssembly functions,通常比传统的 Serverless compute 更高效、更快速,因为它们在一个更精简的 runtime 内运行。默认情况下在全局部署,Edge Functions 在最接近请求的区域运行以尽可能降低延迟。 // pages/api/hello.ts export const config = { runtime: 'edge' } export default function handler(req: Request) { return new Response("Hello World"); } 与 Edge Middleware 不同,Functions 在缓存之后运行;因此既能缓存又能返回响应,非常适合数据获取或重写。Next.js 和许多其他框架(如 Nuxt、Astro 和Sve...
