Silgi
Integrations

SolidStart

Use Silgi with SolidStart API routes.

SolidStart uses file-based API routes powered by Nitro. Silgi integrates via a catch-all endpoint.

Setup

Create a catch-all API route:

// src/routes/api/rpc/[...path].ts
import {  } from 'silgi/solidstart'
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/health

Context from SolidStart middleware

Access middleware data through the event object:

silgiSolidStart(appRouter, {
  : () => ({
    : .locals.user,
  }),
})

What's next?

  • Server — standalone serve() as an alternative
  • Integrations — other available integrations

On this page