skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

netlify-functions

Build serverless API endpoints and background tasks

Developer Setup

Setup & Installation

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

Overview

What This Skill Does

Netlify Functions lets you write serverless functions that run on Netlify's infrastructure. It covers the modern default export syntax, TypeScript support, path and method routing, background functions for long-running tasks, scheduled functions via cron, and streaming responses.

Application

When to use this Skill

Documentation

Show Skills.md file

Netlify Functions

Modern Syntax

Always use the modern default export + Config pattern. Never use the legacy exports.handler or named handler export.

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

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

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

The handler receives a standard Web API Request and returns a Response. The second argument is a Netlify Context object.

File Structure

Place functions in netlify/functions/:

netlify/functions/
  _shared/           # Non-function shared code (underscore prefix)
    auth.ts
    db.ts
  items.ts           # -> /.netlify/functions/items (or custom path via config)
  users/index.ts     # -> /.netlify/functions/users
Lines 1 - 32 of 163

Recommendations

Explore other random skills

All skillsMy patterns