- добавлен shared config presets, custom transforms и allowlist hosts - реализованы Backend endpoints для assets, presets и variants - добавлена orchestration через PostgreSQL, RabbitMQ, S3 и worker - обновлён Gateway read-through flow с L1 cache и корректным Vary: Accept - добавлена миграция resize_mode для variants lookup - обновлены dev scripts, env template, lockfile и документация
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import { NestFactory } from "@nestjs/core"
|
|
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"
|
|
|
|
import { AppModule } from "./app.module"
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule)
|
|
|
|
app.setGlobalPrefix("api")
|
|
app.enableShutdownHooks()
|
|
|
|
const openApiConfig = new DocumentBuilder()
|
|
.setTitle("Image Platform API")
|
|
.setDescription(
|
|
"Backend API для управления image assets, metadata в PostgreSQL, S3 variants, RabbitMQ jobs и генерацией через imgproxy.",
|
|
)
|
|
.setVersion("0.1.0")
|
|
.addTag("system", "Системные endpoints для проверки состояния сервиса.")
|
|
.addTag("assets", "Регистрация и управление исходными изображениями.")
|
|
.addTag("variants", "Будущие endpoints для управления производными версиями изображений.")
|
|
.addTag("allowed-hosts", "Будущие endpoints для управления разрешёнными source hosts.")
|
|
.addTag("internal-images", "Внутренние endpoints, которые вызывает Gateway на cache miss.")
|
|
.addTag("presets", "Статические presets, custom limits и mock allowlist source hosts.")
|
|
.build()
|
|
|
|
const openApiDocument = SwaggerModule.createDocument(app, openApiConfig)
|
|
|
|
SwaggerModule.setup("docs", app, openApiDocument, {
|
|
jsonDocumentUrl: "docs-json",
|
|
swaggerOptions: {
|
|
persistAuthorization: true,
|
|
},
|
|
})
|
|
|
|
const port = Number.parseInt(process.env.BACKEND_PORT ?? process.env.API_PORT ?? "3001", 10)
|
|
|
|
await app.listen(port)
|
|
}
|
|
|
|
void bootstrap()
|