38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.enableCors();
|
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Genex Chain Enterprise API')
|
|
.setDescription(
|
|
'4-tier authenticated blockchain data access: Public / Institutional / Regulatory / Internal',
|
|
)
|
|
.setVersion('1.0')
|
|
.addApiKey({ type: 'apiKey', name: 'X-API-Key', in: 'header' }, 'api-key')
|
|
.addTag('blocks', 'Block queries')
|
|
.addTag('transactions', 'Transaction queries')
|
|
.addTag('address', 'Address balance & token holdings')
|
|
.addTag('coupon', 'Coupon NFT details')
|
|
.addTag('stats', 'Chain statistics')
|
|
.addTag('rpc', 'JSON-RPC proxy (institutional)')
|
|
.addTag('export', 'Batch data export (institutional)')
|
|
.addTag('regulatory', 'Regulatory API (mTLS + cert)')
|
|
.addTag('events', 'Real-time WebSocket subscriptions')
|
|
.build();
|
|
|
|
SwaggerModule.setup('docs', app, SwaggerModule.createDocument(app, config));
|
|
|
|
const port = process.env.PORT || 3020;
|
|
await app.listen(port);
|
|
console.log(`Enterprise API running on :${port} | Swagger: /docs`);
|
|
}
|
|
|
|
bootstrap();
|