backend

Implement Astro server-side API routes that return HTTP responses.

Updated May 1, 2026
One-click install
npx skills add https://github.com/Rachit246-art/rvglobal1 --skill backend-rachit246-art
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend
Source: https://github.com/Rachit246-art/rvglobal1/tree/main/.emdash/skills/backend
Command: npx skills add https://github.com/Rachit246-art/rvglobal1 --skill backend-rachit246-art

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about backend

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create REST API routes in Astro for server-side rendering?

To create REST API routes in Astro for server-side rendering, you scaffold `.ts` files under `src/pages/api/` and export method handlers like `GET`, `POST`, or `DELETE` that return a standard `Response` object with correct HTTP status codes and headers.

How do I parse JSON bodies and query parameters in an Astro API route?

You parse JSON bodies and query parameters in an Astro API route by handling the `APIRoute` request inputs. The parsed data is then used to produce a correct JSON or HTTP response from your server-side endpoint.

Can I use Wix SDK calls inside my Astro API endpoints for ecommerce and CMS data?

Yes, you can use Wix SDK calls inside Astro API endpoints. Server-side Wix SDK operations from `@wix/data`, `@wix/members`, and `@wix/ecom` enable backend logic for CMS data, authentication, and ecommerce operations within your route handlers.

Why should I put my Astro API endpoints in src/pages/api/ instead of src/pages/?

You should place Astro API endpoints in `src/pages/api/` to avoid SPA route conflicts. This file-path mapping ensures clean, conflict-free server-side rendering endpoints under a dedicated directory structure.

What HTTP methods can I export when building server-side API routes in Astro?

You can export `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, and `ALL` method handlers when building server-side API routes in Astro. These exported functions parse request inputs and return standard HTTP `Response` objects with appropriate status codes.