Book a call Free rebuild
Home/Glossary/Astro/Astro Endpoints

Astro Endpoints

By Seahawk November 16, 2026

Astro glossaryAstro endpoints are files in src/pages that return data instead of a page, such as JSON or an RSS feed, by exporting functions like GET and POST.

An endpoint is a .js or .ts file in src/pages/ that returns data instead of a page, by exporting functions named after HTTP methods such as GET and POST. Endpoints serve JSON, RSS feeds, images, or any other response.

  • Static endpoints run at build time and are saved as files: src/pages/data.json.ts becomes /data.json.
  • Server endpoints (API routes) run on each request when the route is rendered on demand, so they can read the request, set headers and status codes, and redirect.

For calls from your own forms and components, Astro Actions often need less code.

Source: Astro docs: Endpoints.

Em Workers

EmDash and Astro sites at revolutionary pricing.

Lightning-fast, secure websites delivered on EmDash and Astro. For the AI-curious bunch.