ToolJet/server/src/main.ts
Akshay e4bcf80af2
Application logger using pino (#600)
* setup application logger with pino

* remove console.log
2021-08-25 22:13:18 +05:30

33 lines
894 B
TypeScript

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as helmet from 'helmet';
import { Logger } from 'nestjs-pino';
const fs = require('fs');
globalThis.TOOLJET_VERSION = fs.readFileSync('./.version', 'utf8');
globalThis.CACHED_CONNECTIONS = {};
async function bootstrap() {
const app = await NestFactory.create(AppModule, { logger: false });
await app.setGlobalPrefix('api');
await app.enableCors();
app.useLogger(app.get(Logger));
app.use(
helmet.contentSecurityPolicy({
useDefaults: true,
directives: {
'script-src': ["'self'", "'unsafe-inline'", "'unsafe-eval'", "blob:"],
'default-src': ["'self'", "blob:"],
},
}),
);
const port = parseInt(process.env.PORT) || 3000;
await app.listen(port, '0.0.0.0', function () {
console.log('Listening on port %d', port);
});
}
bootstrap();