Dashboard can download grouped product variants and re-upload to update price and stock. Also expose Content-Disposition for downloads and keep related product/customer API docs in sync. Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { RequestMethod, ValidationPipe } from '@nestjs/common';
|
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
import { AppModule } from './app.module';
|
|
import { BigIntSerializerInterceptor } from './common/interceptors/bigint-serializer.interceptor';
|
|
import { resolveWebsiteDocsRoot } from './website-docs/website-docs.paths';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
|
|
|
// Public storefront docs — no /api/v1 prefix, no auth
|
|
app.setGlobalPrefix('api/v1', {
|
|
exclude: [
|
|
{ path: 'docs/website', method: RequestMethod.GET },
|
|
{ path: 'docs/website/:fileName', method: RequestMethod.GET },
|
|
],
|
|
});
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
forbidNonWhitelisted: true,
|
|
transform: true,
|
|
}),
|
|
);
|
|
app.useGlobalInterceptors(new BigIntSerializerInterceptor());
|
|
app.enableCors({
|
|
exposedHeaders: ['Content-Disposition'],
|
|
});
|
|
|
|
const port = process.env.PORT ?? 3000;
|
|
await app.listen(port);
|
|
console.log(`API running on http://localhost:${port}/api/v1`);
|
|
console.log(
|
|
`Website API docs: http://localhost:${port}/docs/website (root=${resolveWebsiteDocsRoot()})`,
|
|
);
|
|
}
|
|
|
|
bootstrap();
|