Server Endpoints in Svelte
From the SvelteKit cheat sheet ยท API Routes ยท verified Nov 2026
Server Endpoints
Creating RESTful API endpoints
javascript
// +server.js
export async function GET() {
return Response.json({ message: 'Hello' });
}
export async function POST({ request }) {
const data = await request.json();
return Response.json({ received: data }, { status: 201 });
}๐ RESTful endpoints with +server.js files
๐ Access to cookies and authentication
๐ Full HTTP method support
๐ Return Response.json(), the json() helper is deprecated
Continue with SvelteKit
Save the full cheat sheet or work through every related task.