Integration with Netlify Edge Function
Netlify Edge Function is run on Deno which is one of Elysia support runtime, as Elysia is built on top of Web Standard.
Netlify Edge Functions requires a special directory to run a function, the default is <directory>/netlify/edge-functions.
To create a function at /hello, you would need to create file at netlify/edge-functions/hello.ts, then simply export default an Elysia instance.
::: code-group
import { Elysia } from 'elysia'
export const config = { path: '/hello' } // [!code ++]
export default new Elysia({ prefix: '/hello' }) // [!code ++]
.get('/', () => 'Hello Elysia')
:::
Running locally
To test your Elysia server on Netlify Edge Function locally, you can install Netlify CLI to simluate function invokation.
To install Netlify CLI:
bun add -g netlify-cli
To run the development environment:
netlify dev
For an additional information, please refers to Netlify Edge Function documentation.