Recipes
Add CORS
Import the native Elysia CORS plugin through an Aponia module.
Install the plugin:
bun add @elysiajs/corsRegister it in the root or a shared infrastructure module:
import { cors } from "@elysiajs/cors";
import { Module } from "@aponiajs/common";
import { ElysiaPluginModule } from "@aponiajs/platform-elysia";
@Module({
imports: [
ElysiaPluginModule.register(cors(), {
key: "cors",
}),
],
})
export class AppModule {}The stable key prevents duplicate installation when the configured module is reused through multiple import paths.