|
1 | 1 | import { NestFactory } from '@nestjs/core';
|
2 | 2 | import { AppModule } from './app.module';
|
3 |
| -import { urlencoded,json } from 'express'; |
| 3 | +import { urlencoded, json } from 'express'; |
4 | 4 | import { LogLevel, Logger, ValidationPipe } from '@nestjs/common';
|
5 | 5 | import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
6 |
| -async function bootstrap() { |
7 | 6 |
|
8 |
| - const log_levels: Array<LogLevel> = process.env.LOG_LEVEL ? process.env.LOG_LEVEL.split(',') as Array<LogLevel> : ['log']; |
| 7 | +import * as expressMonitor from 'express-status-monitor'; |
| 8 | +async function bootstrap() { |
| 9 | + const log_levels: Array<LogLevel> = process.env.LOG_LEVEL |
| 10 | + ? (process.env.LOG_LEVEL.split(',') as Array<LogLevel>) |
| 11 | + : ['log']; |
9 | 12 |
|
10 | 13 | const app = await NestFactory.create(AppModule, {
|
11 | 14 | rawBody: true,
|
12 | 15 | logger: log_levels,
|
13 |
| - |
14 |
| - |
15 | 16 | });
|
16 | 17 |
|
17 |
| - app.useGlobalPipes(new ValidationPipe({ |
18 |
| - validateCustomDecorators: true, |
19 |
| - })); |
| 18 | + app.use( |
| 19 | + expressMonitor({ |
| 20 | + chartVisibility: { |
| 21 | + cpu: true, |
| 22 | + mem: true, |
| 23 | + load: true, |
| 24 | + eventLoop: true, |
| 25 | + heap: true, |
| 26 | + responseTime: true, |
| 27 | + rps: true, |
| 28 | + statusCodes: true, |
| 29 | + }, |
| 30 | + }), |
| 31 | + ); |
| 32 | + app.useGlobalPipes( |
| 33 | + new ValidationPipe({ |
| 34 | + validateCustomDecorators: true, |
| 35 | + }), |
| 36 | + ); |
20 | 37 |
|
21 | 38 | const config = new DocumentBuilder()
|
22 | 39 | .setTitle('Encrypted Data Vault API')
|
@@ -199,19 +216,12 @@ window.addEventListener('load', function() {
|
199 | 216 | })
|
200 | 217 | })
|
201 | 218 |
|
202 |
| -` |
203 |
| - , |
204 |
| - |
205 |
| - |
206 |
| - |
207 |
| - |
208 |
| - |
209 |
| - |
210 |
| - |
211 |
| - |
212 |
| - |
| 219 | +`, |
213 | 220 | });
|
214 | 221 | await app.listen(process.env.PORT);
|
215 |
| - Logger.log(`Server running on http://localhost:${process.env.PORT}`, 'VaultServerBootstrap'); |
| 222 | + Logger.log( |
| 223 | + `Server running on http://localhost:${process.env.PORT}`, |
| 224 | + 'VaultServerBootstrap', |
| 225 | + ); |
216 | 226 | }
|
217 | 227 | bootstrap();
|
0 commit comments