Function: createElysiaNestApplicationWithControllers()
ts
function createElysiaNestApplicationWithControllers(server, controllers?): ElysiaNestApplication;Defined in: packages/microservices/src/factory.ts:66
Creates a new ElysiaNestApplication with a set of controllers pre-registered for pattern handler scanning.
Like createElysiaNestApplication, this bypasses the module system. Prefer createElysiaApplication(AppModule) for module-based apps.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
server | Elysia | undefined | A pre-configured Elysia application. |
controllers | Type<unknown>[] | [] | Controller classes to scan for @MessagePattern and @EventPattern decorators. |
Returns
Example
typescript
const elysiaApp = new Elysia().get('/health', () => 'ok');
const app = createElysiaNestApplicationWithControllers(elysiaApp, [
MathController,
OrdersController,
]);
app.connectMicroservice({ transport: Transport.REDIS, options: {} });
await app.startAllMicroservices();
await app.listen(3000);