Skip to content

Elysia

To use Elysia as the main provider with Nixle, you need to install the @nixle/elysia package. This package provides the necessary functionality for integrating Elysia into your Nixle application.

Install

You can install the @nixle/elysia package using npm, pnpm, yarn, or bun:

sh
npm i @nixle/elysia
sh
pnpm add @nixle/elysia
sh
yarn add @nixle/elysia
sh
bun i @nixle/elysia

Setup

ts
import { Elysia } from 'elysia';
import { createApp, createRouter } from 'nixle';
import { elysiaProvider } from '@nixle/elysia';

const usersRouter = createRouter('/users', ({ route }) => [
  route.get('/', () => 'Hello Elysia!'),
]);

const { app } = createApp({
  provider: elysiaProvider(new Elysia()),
  routers: [usersRouter],
});

app.listen(4000);

Example