What problem does it solve?
It helps you design and implement backend API endpoints in an Astro project so your app can safely handle requests, process data on the server, and return correct HTTP responses.
Core Features & Use Cases
- Server API route scaffolding in
src/pages/api/: Create clean, conflict-free endpoints by mapping file paths to URLs and exporting method handlers like GET, POST, PUT, DELETE, PATCH, and ALL.
- Strong request/response handling: Parse JSON bodies and form data, read query params and headers, set cookies, and always return a standard
Response with appropriate status codes and Content-Type.
- Wix SDK operations inside endpoints: Use Wix server-side SDK calls (e.g.,
@wix/data, @wix/members, @wix/ecom, @wix/redirects) to implement CMS, authentication-related, and ecommerce backend logic.
Quick Start
Create your endpoint as a .ts file under src/pages/api/ (for example, src/pages/api/hello.ts) and export a GET handler that returns a Response with JSON data.