0.0.2-10 • Published 8 months ago
@ghentcdh/tools-api v0.0.2-10
This library consist of a group of tools used by the GhentCDH projects.
Health api
This will add a health check endpoint to the nestjs application.
Add it to the AppModule
imports
import { HealthApiModule } from '@ghentcdh/tools/health/api';
@Module({
imports: [
...
HealthApiModule,
],
})
export class AppModule {}
Logging api for nestjs application
Configuration
- adjust the nestjs file
main.ts
to include the logging module
import {Logger as MyLogger} from '@ghentcdh/tools/api';
// bootstrap the application
async function bootstrap() {
const app = await NestFactory.create(AppModule);
//...
app.useLogger(new MyLogger())
//...
}
- configure the logging environment variable
LOG_DIR
in the.env
file
LOG_DIR=/tmp/logs
- Use the logging command
import {Logger} from '@ghentcdh/tools/api';
Logger.log('Nest hello api', 'AppController');