Skip to main content

Basic Route Example

A minimal API route that responds to GET:

// src/api/hello/route.ts
import type { BurgerContext } from "burger-api";

export async function GET(ctx: BurgerContext) {
return Response.json({ message: "Hello, Burger API!" });
}

The handler receives a BurgerContext (ctx) and always returns a standard Web Response. Use ctx to read request data: query, params, body, headers, cookies. See Request API.

This maps to GET /api/hello (with the default apiPrefix). See Static API Routes and the Hello World tutorial.