netlify-edge-functions
Installation
SKILL.md
Netlify Edge Functions
Use this form
// netlify/edge-functions/hello.ts
import type { Config, Context } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
return new Response(`Hello from ${context.geo.country?.name ?? "somewhere"}`);
};
export const config: Config = { path: "/hello" };
- One file = one function: a default-export handler plus a
configexport with the route. Alternatively, declare the route innetlify.toml. RequestandResponseare global. ImportContextandConfigtypes from@netlify/edge-functions.- Read env vars with
Netlify.env.get().process.envworks only for Next.js middleware.