mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 08:28:35 +00:00
33 lines
894 B
TypeScript
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();
|