bizmatch-project/bizmatch-server/src/main.ts

28 lines
1010 B
TypeScript

import { LoggerService } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import express from 'express';
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
import { AppModule } from './app.module';
async function bootstrap() {
const server = express();
server.set('trust proxy', true);
const app = await NestFactory.create(AppModule);
// const logger = app.get<Logger>(WINSTON_MODULE_NEST_PROVIDER);
const logger = app.get<LoggerService>(WINSTON_MODULE_NEST_PROVIDER);
app.useLogger(logger);
//app.use('/bizmatch/payment/webhook', bodyParser.raw({ type: 'application/json' }));
// Serve static files from pictures directory
app.use('/pictures', express.static('pictures'));
app.setGlobalPrefix('bizmatch');
app.enableCors({
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
allowedHeaders: 'Content-Type, Accept, Authorization, x-hide-loading',
});
await app.listen(process.env.PORT || 3001);
}
bootstrap();