mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
* feat(web): SPA * chore: remove unnecessary prune * feat(web): merge with immich-server * Correct method name * fix: bugs, docs, workflows, etc. * chore: keep dockerignore for dev * chore: remove license * fix: expose 2283 --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { envName, getLogLevels, isDev, serverVersion } from '@app/domain';
|
|
import { RedisIoAdapter } from '@app/infra';
|
|
import { Logger } from '@nestjs/common';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
import { json } from 'body-parser';
|
|
import cookieParser from 'cookie-parser';
|
|
import { AppModule } from './app.module';
|
|
import { indexFallback, useSwagger } from './app.utils';
|
|
|
|
const logger = new Logger('ImmichServer');
|
|
const port = Number(process.env.SERVER_PORT) || 3001;
|
|
|
|
export async function bootstrap() {
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule, { logger: getLogLevels() });
|
|
|
|
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);
|
|
app.set('etag', 'strong');
|
|
app.use(cookieParser());
|
|
app.use(json({ limit: '10mb' }));
|
|
if (isDev) {
|
|
app.enableCors();
|
|
}
|
|
app.useWebSocketAdapter(new RedisIoAdapter(app));
|
|
useSwagger(app, isDev);
|
|
|
|
const excludePaths = ['/.well-known/immich', '/custom.css'];
|
|
app.setGlobalPrefix('api', { exclude: excludePaths });
|
|
app.useStaticAssets('www');
|
|
app.use(indexFallback(excludePaths));
|
|
|
|
const server = await app.listen(port);
|
|
server.requestTimeout = 30 * 60 * 1000;
|
|
|
|
logger.log(`Immich Server is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
|
}
|