Integrations
Remix
Use Silgi with Remix action/loader routes.
Remix uses file-based routing with action and loader exports. Silgi integrates via a catch-all splat route.
Setup
Create a catch-all route:
// app/routes/rpc.$.tsx
import { } from 'silgi/remix'
import { } from '~/server/rpc'
const = (, {
: '/rpc',
: () => ({
: getDB(),
: .(.request.headers),
}),
})
export const =
export const = Procedures are accessible at:
POST /rpc/users/list
POST /rpc/users/create
GET /rpc/healthContext from Remix loaders
The context function receives the standard Remix LoaderFunctionArgs / ActionFunctionArgs object:
silgiRemix(appRouter, {
: () => ({
: .context.user, // from Remix server context
: .params,
}),
})What's next?
- Server — standalone
serve()as an alternative - Integrations — other available integrations