Untitled Page

ID: 2285https://elysiajs.com/integrations/deno.md
Source

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

import { Elysia } from 'elysia'

const app = new Elysia()
	.get('/', () => 'Hello Elysia')
	.listen(3000) // [!code --]

Deno.serve(app.fetch) // [!code ++]

Then you can run the server with deno serve:

deno serve --watch src/index.ts

This is all you need to run Elysia on Deno.

Change Port Number

You can specify the port number in Deno.serve.

Deno.serve(app.fetch) // [!code --]
Deno.serve({ port:8787 }, app.fetch) // [!code ++]