skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

netlify-edge-functions

Low-latency edge middleware and geolocation logic

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/netlify/context-and-tools --skill netlify-edge-functions

Overview

What This Skill Does

Netlify Edge Functions run on a globally distributed Deno runtime, executing code at the network edge closest to each user. The skill covers the middleware pattern using context.next(), geolocation access, request/response manipulation, and when to use edge compute over standard serverless functions.

Application

When to use this Skill

Documentation

Show Skills.md file

Netlify Edge Functions

Edge functions run on Netlify's globally distributed edge network (Deno runtime), providing low-latency responses close to users.

Syntax

import type { Config, Context } from "@netlify/edge-functions";

export default async (req: Request, context: Context) => {
  return new Response("Hello from the edge!");
};

export const config: Config = {
  path: "/hello",
};

Place files in netlify/edge-functions/. Uses .ts, .js, .tsx, or .jsx extensions.

Config Object

export const config: Config = {
  path: "/api/*",                    // URLPattern path(s)
  excludedPath: "/api/public/*",     // Exclusions
  method: ["GET", "POST"],           // HTTP methods
  onError: "bypass",                 // "fail" (default), "bypass", or "/error-page"
  cache: "manual",                   // Enable response caching
};
Lines 1 - 31 of 121

Recommendations

Explore other random skills

All skillsMy patterns