Integrations
Astro
Use Silgi with Astro API routes.
Astro supports server-side API routes via file-based routing. Silgi integrates via a catch-all endpoint.
Setup
Create a catch-all API route:
// src/pages/api/rpc/[...path].ts
import { } from 'silgi/astro'
import { } from '~/server/rpc'
const = (, {
: '/api/rpc',
: () => ({
: getDB(),
: .(.request.headers),
}),
})
export const =
export const = Procedures are accessible at:
POST /api/rpc/users/list
POST /api/rpc/users/create
GET /api/rpc/healthSSR mode
Silgi requires server-side rendering. Enable it in your Astro config:
// astro.config.mjs
export default defineConfig({
: 'server',
})What's next?
- Server — standalone
serve()as an alternative - Integrations — other available integrations