Silgi

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/[...path].ts
import {  } from 'silgi/solidstart'
import {  } from '~/server/rpc'

const  = (, {
  : () => ({
    : getDB(),
    : .(.request.headers),
  }),
})

export const  = 
export const  = 

Procedures are accessible at:

POST /api/users/list
POST /api/users/create
GET  /api/health

Context from SolidStart middleware

Access middleware data through the event object:

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

Analytics and Scalar

Enable the built-in analytics dashboard or Scalar API reference directly in the adapter:

const  = createHandler(appRouter, {
  : () => ({ : .locals.user }),
  : {
    : process.env.ANALYTICS_TOKEN,
  },
  : true,
})

What's next?

  • Analytics — built-in monitoring dashboard
  • Server — standalone serve() as an alternative
  • Integrations — other available integrations

On this page