0.1.0-alpha.23 • Published 2 years ago

@zarja/http v0.1.0-alpha.23

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Usage

// modules/app.module.ts
import { createLoggerConfig, ZarjaHttp } from '@zarja/http'
import { NestFactory, Module } from '@nestjs/common'
import { LoggerModule } from 'nestjs-pino'
import { config } from '../common/config' // Environment configuration

async function createApp() {
  const app = NestFactory.create(AppModule, { bufferLogs: true })

  ZarjaHttp.setup(app, {
    serialization: {
      serializeResponses: true,
      excludeNullFromResponse: true
    },
    logger: config.logger
  })

  return app
}

@Module({
  import: [
    LoggerModule.forRootAsync(createLoggerConfig(config.logger)),
    // ...
  ]
})
export class AppModule {}
// main.ts
import { createApp } from './modules/app.module'

createApp().then(app => app.start())