Silgi
Integrations

Elysia

Use Silgi with Elysia on Bun — register as an Elysia plugin.

Elysia is a fast web framework for Bun. Silgi integrates as an Elysia plugin.

Setup

import {  } from 'elysia'
import {  } from 'silgi/elysia'

const  = new ()
  .('/', () => 'Hello from Elysia')
  .(
    (appRouter, {
      : '/rpc',
      : () => ({
        : getDB(),
        : .store?.user,
      }),
    }),
  )
  .(3000)

Context

The context factory receives the Elysia context — access store, request, query, etc.:

silgiElysia(appRouter, {
  : () => ({
    : .store?.user,
    : .request.headers.get('x-forwarded-for'),
  }),
})

What's next?

  • Hono — another Bun-compatible framework option
  • Integrations — other available integrations

On this page