Integration with Deno
Elysia is built on top of Web Standard Request/Response, allowing us to run Elysia with Deno.serve directly.
To run Elysia on Deno, wrap Elysia.fetch in Deno.serve
typescript
import { Elysia } from 'elysia'
const app = new Elysia()
.get('/', () => 'Hello Elysia')
.listen(3000)
Deno.serve(app.fetch) Then you can run the server with deno serve:
bash
deno serve --watch src/index.tsThis is all you need to run Elysia on Deno.
Change Port Number
You can specify the port number in Deno.serve.
ts
Deno.serve(app.fetch)
Deno.serve({ port:8787 }, app.fetch) pnpm
If you use pnpm, pnpm doesn't auto install peer dependencies by default forcing you to install additional dependencies manually.
bash
pnpm add @sinclair/typebox openapi-types