fix git
This commit is contained in:
25
storage_server/src/main.ts
Normal file
25
storage_server/src/main.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { join } from 'path';
|
||||
|
||||
async function bootstrap() {
|
||||
const logger = new Logger('Bootstrap');
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// Enable CORS for static file downloading/fetching across origins
|
||||
app.enableCors({
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
const port = process.env.PORT ?? 8081;
|
||||
const storageDir = process.env.STORAGE_DIR || join(__dirname, '..', '..', 'storage');
|
||||
|
||||
await app.listen(port);
|
||||
|
||||
logger.log(`Storage static file server is running on: http://localhost:${port}`);
|
||||
logger.log(`Serving static files from: ${storageDir}`);
|
||||
}
|
||||
bootstrap();
|
||||
Reference in New Issue
Block a user