Integration with Netlify Edge Function
Netlify Edge Functions run on Deno, which is one of Elysia's supported runtimes, as Elysia is built on top of Web Standards.
Netlify Edge Functions require 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 a file at netlify/edge-functions/hello.ts, then simply export default an Elysia instance.
import { Elysia } from 'elysia'
export const config = { path: '/hello' }
export default new Elysia({ prefix: '/hello' })
.get('/', () => 'Hello Elysia')Running locally
To test your Elysia server on Netlify Edge Functions locally, you can install the Netlify CLI to simulate function invocation.
To install Netlify CLI:
bun add -g netlify-cliTo run the development environment:
netlify devFor additional information, please refer to the Netlify Edge Functions documentation.
pnpm
If you use pnpm, pnpm doesn't auto install peer dependencies by default forcing you to install additional dependencies manually.
pnpm add @sinclair/typebox openapi-types