prepare the server

This commit is contained in:
Sven Czarnian
2022-10-22 17:19:20 +02:00
parent 5718d6bcf8
commit 31c9739d38
3 changed files with 22 additions and 0 deletions

14
package-lock.json generated
View File

@@ -14,6 +14,7 @@
"@nestjs/core": "^9.0.0", "@nestjs/core": "^9.0.0",
"@nestjs/mongoose": "^9.2.0", "@nestjs/mongoose": "^9.2.0",
"@nestjs/platform-express": "^9.0.0", "@nestjs/platform-express": "^9.0.0",
"helmet": "^6.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"mongoose": "^6.6.7", "mongoose": "^6.6.7",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
@@ -4550,6 +4551,14 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/helmet": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-6.0.0.tgz",
"integrity": "sha512-FO9RpR1wNJepH/GbLPQVtkE2eESglXL641p7SdyoT4LngHFJcZheHMoyUcjCZF4qpuMMO1u5q6RK0l9Ux8JBcg==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/hexoid": { "node_modules/hexoid": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
@@ -12004,6 +12013,11 @@
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
}, },
"helmet": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-6.0.0.tgz",
"integrity": "sha512-FO9RpR1wNJepH/GbLPQVtkE2eESglXL641p7SdyoT4LngHFJcZheHMoyUcjCZF4qpuMMO1u5q6RK0l9Ux8JBcg=="
},
"hexoid": { "hexoid": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",

View File

@@ -26,6 +26,7 @@
"@nestjs/core": "^9.0.0", "@nestjs/core": "^9.0.0",
"@nestjs/mongoose": "^9.2.0", "@nestjs/mongoose": "^9.2.0",
"@nestjs/platform-express": "^9.0.0", "@nestjs/platform-express": "^9.0.0",
"helmet": "^6.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"mongoose": "^6.6.7", "mongoose": "^6.6.7",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",

View File

@@ -1,8 +1,15 @@
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import helmet from 'helmet';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
app.use(helmet());
app.enableCors();
app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
await app.listen(3000); await app.listen(3000);
} }
bootstrap(); bootstrap();