Browse Source

Add mongodb to nest framework, update deps (#5528)

Patryk Strugacz 5 years ago
parent
commit
6ac19c3ea9

+ 6 - 25
frameworks/TypeScript/nest/README.md

@@ -1,32 +1,13 @@
 # NestJS Benchmarking Test
 # NestJS Benchmarking Test
 
 
-This is the Nest portion of a [benchmarking test suite](../).
+This is the NestJS portion of a [benchmarking test suite](../).
 
 
 
 
-## Infrastructure Software Versions
+## Infrastructure Software
 The tests were run with:
 The tests were run with:
-* [NestJS v6.6.7](https://docs.nestjs.com/)
-* [pg 7.12.1](https://node-postgres.com/)
+* [NestJS](https://docs.nestjs.com/)
 
 
 ## Resources
 ## Resources
-* http://nodejs.org/api/cluster.html
-
-## Test URLs
-### JSON Encoding Test
-
-http://localhost:8080/bench/json
-
-### Data-Store/Database Mapping Test
-
-PostgreSQL:
-http://localhost:8080/bencg/db
-
-### Variable Query Test
-
-PostgreSQL:
-http://localhost:8080/bench/queries?queries=2
-
-### Update Query Test
-
-PostgreSQL:
-http://localhost:8080/bench/updates?queries=2
+* [Cluster](http://nodejs.org/api/cluster.html)
+* [TypeORM](https://docs.nestjs.com/techniques/database#typeorm-integration)
+* [Fastify](https://docs.nestjs.com/techniques/performance)

+ 40 - 0
frameworks/TypeScript/nest/benchmark_config.json

@@ -42,6 +42,26 @@
         "display_name": "nestjs",
         "display_name": "nestjs",
         "versus": "nodejs"
         "versus": "nodejs"
       },
       },
+      "mongo": {
+        "json_url": "/json",
+        "db_url": "/db",
+        "query_url": "/queries?queries=",
+        "fortune_url": "/fortunes",
+        "update_url": "/updates?queries=",
+        "plaintext_url": "/plaintext",
+        "cached_query_url": "/cached-worlds?count=",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "framework": "nestjs",
+        "language": "TypeScript",
+        "os": "Linux",
+        "orm": "Full",
+        "database": "MongoDB",
+        "database_os": "Linux",
+        "display_name": "nestjs",
+        "versus": "nodejs"
+      },
       "fastify": {
       "fastify": {
         "json_url": "/json",
         "json_url": "/json",
         "db_url": "/db",
         "db_url": "/db",
@@ -81,6 +101,26 @@
         "database_os": "Linux",
         "database_os": "Linux",
         "display_name": "nestjs",
         "display_name": "nestjs",
         "versus": "nodejs"
         "versus": "nodejs"
+      },
+      "fastify-mongo": {
+        "json_url": "/json",
+        "db_url": "/db",
+        "query_url": "/queries?queries=",
+        "fortune_url": "/fortunes",
+        "update_url": "/updates?queries=",
+        "plaintext_url": "/plaintext",
+        "cached_query_url": "/cached-worlds?count=",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "MongoDB",
+        "framework": "nestjs",
+        "language": "TypeScript",
+        "orm": "Full",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "nestjs",
+        "versus": "nodejs"
       }
       }
     }
     }
   ]
   ]

+ 13 - 0
frameworks/TypeScript/nest/nestjs-fastify-mongo.dockerfile

@@ -0,0 +1,13 @@
+FROM node:12.16.1-slim
+
+COPY ./ ./
+
+RUN npm install
+RUN npm run build
+
+ENV NODE_ENV production
+ENV DATABASE_CONFIGURATION_PROFILE mongodb
+ENV FRAMEWORK fastify
+
+EXPOSE 8080
+CMD ["node", "dist/main"]

+ 2 - 2
frameworks/TypeScript/nest/nestjs-fastify-mysql.dockerfile

@@ -6,8 +6,8 @@ RUN npm install
 RUN npm run build
 RUN npm run build
 
 
 ENV NODE_ENV production
 ENV NODE_ENV production
-ENV DATABASE_CONFIGURATION_PROFILE=mysql
-ENV FRAMEWORK=fastify
+ENV DATABASE_CONFIGURATION_PROFILE mysql
+ENV FRAMEWORK fastify
 
 
 EXPOSE 8080
 EXPOSE 8080
 CMD ["node", "dist/main"]
 CMD ["node", "dist/main"]

+ 2 - 2
frameworks/TypeScript/nest/nestjs-fastify.dockerfile

@@ -6,8 +6,8 @@ RUN npm install
 RUN npm run build
 RUN npm run build
 
 
 ENV NODE_ENV production
 ENV NODE_ENV production
-ENV DATABASE_CONFIGURATION_PROFILE=postgres
-ENV FRAMEWORK=fastify
+ENV DATABASE_CONFIGURATION_PROFILE postgres
+ENV FRAMEWORK fastify
 
 
 EXPOSE 8080
 EXPOSE 8080
 CMD ["node", "dist/main"]
 CMD ["node", "dist/main"]

+ 13 - 0
frameworks/TypeScript/nest/nestjs-mongo.dockerfile

@@ -0,0 +1,13 @@
+FROM node:12.16.1-slim
+
+COPY ./ ./
+
+RUN npm install
+RUN npm run build
+
+ENV NODE_ENV production
+ENV DATABASE_CONFIGURATION_PROFILE mongodb
+ENV FRAMEWORK express
+
+EXPOSE 8080
+CMD ["node", "dist/main"]

+ 2 - 2
frameworks/TypeScript/nest/nestjs-mysql.dockerfile

@@ -6,8 +6,8 @@ RUN npm install
 RUN npm run build
 RUN npm run build
 
 
 ENV NODE_ENV production
 ENV NODE_ENV production
-ENV DATABASE_CONFIGURATION_PROFILE=mysql
-ENV FRAMEWORK=express
+ENV DATABASE_CONFIGURATION_PROFILE mysql
+ENV FRAMEWORK express
 
 
 EXPOSE 8080
 EXPOSE 8080
 CMD ["node", "dist/main"]
 CMD ["node", "dist/main"]

+ 2 - 2
frameworks/TypeScript/nest/nestjs.dockerfile

@@ -6,8 +6,8 @@ RUN npm install
 RUN npm run build
 RUN npm run build
 
 
 ENV NODE_ENV production
 ENV NODE_ENV production
-ENV DATABASE_CONFIGURATION_PROFILE=postgres
-ENV FRAMEWORK=express
+ENV DATABASE_CONFIGURATION_PROFILE postgres
+ENV FRAMEWORK express
 
 
 EXPOSE 8080
 EXPOSE 8080
 CMD ["node", "dist/main"]
 CMD ["node", "dist/main"]

+ 13 - 8
frameworks/TypeScript/nest/ormconfig.js

@@ -1,22 +1,28 @@
 let config = {
 let config = {
   synchronize: false,
   synchronize: false,
   logging: false,
   logging: false,
-  entities:
-    process.env.NODE_ENV === 'production'
-      ? ['./dist/**/*.entity.js']
-      : ['./dist/**/*.entity.js', './src/**/*.entity.ts'],
+  host: 'tfb-database',
+  database: 'hello_world',
 };
 };
 
 
 switch (process.env.DATABASE_CONFIGURATION_PROFILE) {
 switch (process.env.DATABASE_CONFIGURATION_PROFILE) {
+  case 'mongodb':
+    config = {
+      ...config,
+      type: 'mongodb',
+      port: 27017,
+      entities: ['./dist/mongo/*.entity.js'],
+      useUnifiedTopology: true,
+    };
+    break;
   case 'mysql':
   case 'mysql':
     config = {
     config = {
       ...config,
       ...config,
       type: 'mysql',
       type: 'mysql',
-      host: 'tfb-database',
       port: 3306,
       port: 3306,
       username: 'benchmarkdbuser',
       username: 'benchmarkdbuser',
       password: 'benchmarkdbpass',
       password: 'benchmarkdbpass',
-      database: 'hello_world',
+      entities: ['./dist/sql/*.entity.js'],
     };
     };
     break;
     break;
   case 'postgres':
   case 'postgres':
@@ -24,11 +30,10 @@ switch (process.env.DATABASE_CONFIGURATION_PROFILE) {
     config = {
     config = {
       ...config,
       ...config,
       type: 'postgres',
       type: 'postgres',
-      host: 'tfb-database',
       port: 5432,
       port: 5432,
       username: 'benchmarkdbuser',
       username: 'benchmarkdbuser',
       password: 'benchmarkdbpass',
       password: 'benchmarkdbpass',
-      database: 'hello_world',
+      entities: ['./dist/sql/*.entity.js'],
     };
     };
     break;
     break;
 }
 }

+ 16 - 16
frameworks/TypeScript/nest/package.json

@@ -1,7 +1,7 @@
 {
 {
   "name": "nest",
   "name": "nest",
   "version": "0.0.0",
   "version": "0.0.0",
-  "description": "description",
+  "description": "NestJS App",
   "author": "",
   "author": "",
   "license": "MIT",
   "license": "MIT",
   "scripts": {
   "scripts": {
@@ -15,32 +15,32 @@
     "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
     "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
   },
   },
   "dependencies": {
   "dependencies": {
-    "@nestjs/common": "6.11.8",
-    "@nestjs/core": "6.11.8",
-    "@nestjs/platform-express": "6.11.8",
-    "@nestjs/platform-fastify": "6.11.8",
+    "@nestjs/common": "6.11.11",
+    "@nestjs/core": "6.11.11",
+    "@nestjs/platform-express": "6.11.11",
+    "@nestjs/platform-fastify": "6.11.11",
     "@nestjs/typeorm": "6.3.3",
     "@nestjs/typeorm": "6.3.3",
-    "cache-manager": "3.0.0",
-    "dotenv": "8.2.0",
-    "fastify": "2.12.0",
+    "cache-manager": "3.1.0",
+    "fastify": "2.12.1",
     "fastify-formbody": "3.1.0",
     "fastify-formbody": "3.1.0",
-    "hbs": "4.1.0",
     "handlebars": "4.7.3",
     "handlebars": "4.7.3",
+    "hbs": "4.1.0",
+    "mongodb": "3.5.4",
     "mysql2": "2.1.0",
     "mysql2": "2.1.0",
     "pg": "7.18.2",
     "pg": "7.18.2",
-    "point-of-view": "3.7.1",
+    "point-of-view": "3.7.2",
     "reflect-metadata": "0.1.13",
     "reflect-metadata": "0.1.13",
     "rimraf": "3.0.2",
     "rimraf": "3.0.2",
     "rxjs": "6.5.4",
     "rxjs": "6.5.4",
-    "typeorm": "0.2.22"
+    "typeorm": "0.2.24"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@nestjs/cli": "6.14.2",
     "@nestjs/cli": "6.14.2",
     "@nestjs/schematics": "6.9.4",
     "@nestjs/schematics": "6.9.4",
-    "@types/express": "4.17.2",
-    "@types/node": "13.7.4",
-    "@typescript-eslint/eslint-plugin": "2.20.0",
-    "@typescript-eslint/parser": "2.20.0",
+    "@types/express": "4.17.3",
+    "@types/node": "13.7.7",
+    "@typescript-eslint/eslint-plugin": "2.22.0",
+    "@typescript-eslint/parser": "2.22.0",
     "eslint": "6.8.0",
     "eslint": "6.8.0",
     "eslint-config-prettier": "6.10.0",
     "eslint-config-prettier": "6.10.0",
     "eslint-plugin-import": "2.20.1",
     "eslint-plugin-import": "2.20.1",
@@ -49,6 +49,6 @@
     "ts-loader": "6.2.1",
     "ts-loader": "6.2.1",
     "ts-node": "8.6.2",
     "ts-node": "8.6.2",
     "tsconfig-paths": "3.9.0",
     "tsconfig-paths": "3.9.0",
-    "typescript": "3.8.2"
+    "typescript": "3.8.3"
   }
   }
 }
 }

+ 28 - 11
frameworks/TypeScript/nest/src/main.ts

@@ -5,18 +5,25 @@ import {
   FastifyAdapter,
   FastifyAdapter,
   NestFastifyApplication,
   NestFastifyApplication,
 } from '@nestjs/platform-fastify';
 } from '@nestjs/platform-fastify';
-import 'dotenv/config';
+import { MongoModule } from './mongo/mongo.module';
 import { join } from 'path';
 import { join } from 'path';
-import { AppModule } from './app.module';
+import { SqlModule } from './sql/sql.module';
 import cluster = require('cluster');
 import cluster = require('cluster');
 import os = require('os');
 import os = require('os');
 
 
 const port = process.env.PORT || 8080;
 const port = process.env.PORT || 8080;
 
 
 async function bootstrapExpress() {
 async function bootstrapExpress() {
-  const app = await NestFactory.create<NestExpressApplication>(AppModule, {
-    logger: false,
-  });
+  let app;
+  if (process.env.DATABASE_CONFIGURATION_PROFILE === 'mongodb') {
+    app = await NestFactory.create<NestExpressApplication>(MongoModule, {
+      logger: false,
+    });
+  } else {
+    app = await NestFactory.create<NestExpressApplication>(SqlModule, {
+      logger: false,
+    });
+  }
 
 
   app.setBaseViewsDir(join(__dirname, '..', 'views'));
   app.setBaseViewsDir(join(__dirname, '..', 'views'));
   app.setViewEngine('hbs');
   app.setViewEngine('hbs');
@@ -26,11 +33,21 @@ async function bootstrapExpress() {
 }
 }
 
 
 async function bootstrapFastify() {
 async function bootstrapFastify() {
-  const app = await NestFactory.create<NestFastifyApplication>(
-    AppModule,
-    new FastifyAdapter(),
-    { logger: false },
-  );
+  let app;
+  if (process.env.DATABASE_CONFIGURATION_PROFILE === 'mongodb') {
+    app = await NestFactory.create<NestFastifyApplication>(
+      MongoModule,
+      new FastifyAdapter(),
+      { logger: false },
+    );
+  } else {
+    app = await NestFactory.create<NestFastifyApplication>(
+      SqlModule,
+      new FastifyAdapter(),
+      { logger: false },
+    );
+  }
+
   app.setViewEngine({
   app.setViewEngine({
     engine: {
     engine: {
       handlebars: require('handlebars'),
       handlebars: require('handlebars'),
@@ -46,7 +63,7 @@ if (cluster.isMaster) {
     cluster.fork();
     cluster.fork();
   }
   }
 
 
-  Logger.log('NestJS master starting ' + new Date().toISOString());
+  Logger.log(`NestJS master ${process.pid} started`);
   cluster.on('exit', () => {
   cluster.on('exit', () => {
     process.exit(1);
     process.exit(1);
   });
   });

+ 10 - 0
frameworks/TypeScript/nest/src/mongo/fortune.entity.ts

@@ -0,0 +1,10 @@
+import { Column, Entity, ObjectIdColumn } from 'typeorm';
+
+@Entity('fortune')
+export class Fortune {
+  @ObjectIdColumn()
+  id: number;
+
+  @Column('text')
+  message: string;
+}

+ 61 - 0
frameworks/TypeScript/nest/src/mongo/mongo.controller.ts

@@ -0,0 +1,61 @@
+import {
+  CacheInterceptor,
+  Controller,
+  Get,
+  Header,
+  Query,
+  Render,
+  UseInterceptors,
+} from '@nestjs/common';
+import { MongoService } from './mongo.service';
+
+@Controller()
+export class MongoController {
+  constructor(private readonly mongoService: MongoService) {}
+
+  @Get('/json')
+  @Header('Server', 'NestJS')
+  @Header('Content-Type', 'application/json')
+  getJson() {
+    return { message: 'Hello, World!' };
+  }
+
+  @Get('db')
+  @Header('Server', 'NestJS')
+  getSingleQuery() {
+    return this.mongoService.singleQuery();
+  }
+
+  @Get('queries')
+  @Header('Server', 'NestJS')
+  getMultiQueries(@Query('queries') queries) {
+    return this.mongoService.multiQueries(queries);
+  }
+
+  @Get('fortunes')
+  @Header('Server', 'NestJS')
+  @Render('fortunes.hbs')
+  getFortunes() {
+    return this.mongoService.fortunes();
+  }
+
+  @Get('updates')
+  @Header('Server', 'NestJS')
+  getUpdates(@Query('queries') queries) {
+    return this.mongoService.updates(queries);
+  }
+
+  @Get('plaintext')
+  @Header('Server', 'NestJS')
+  @Header('Content-Type', 'text/plain')
+  getHello(): string {
+    return 'Hello, World!';
+  }
+
+  @Get('/cached-worlds')
+  @Header('Server', 'NestJS')
+  @UseInterceptors(CacheInterceptor)
+  getCachedWorlds(@Query('count') count) {
+    return this.mongoService.cachedWorlds(count);
+  }
+}

+ 17 - 0
frameworks/TypeScript/nest/src/mongo/mongo.module.ts

@@ -0,0 +1,17 @@
+import { CacheModule, Module } from '@nestjs/common';
+import { TypeOrmModule } from '@nestjs/typeorm';
+import { Fortune } from './fortune.entity';
+import { MongoController } from './mongo.controller';
+import { MongoService } from './mongo.service';
+import { World } from './world.entity';
+
+@Module({
+  imports: [
+    TypeOrmModule.forRoot(),
+    TypeOrmModule.forFeature([World, Fortune]),
+    CacheModule.register(),
+  ],
+  controllers: [MongoController],
+  providers: [MongoService],
+})
+export class MongoModule {}

+ 72 - 0
frameworks/TypeScript/nest/src/mongo/mongo.service.ts

@@ -0,0 +1,72 @@
+import { Injectable } from '@nestjs/common';
+import { InjectRepository } from '@nestjs/typeorm';
+import { MongoRepository } from 'typeorm';
+import { Fortune } from './fortune.entity';
+import { World } from './world.entity';
+
+@Injectable()
+export class MongoService {
+  constructor(
+    @InjectRepository(World)
+    private readonly worldRepository: MongoRepository<World>,
+    @InjectRepository(Fortune)
+    private readonly fortuneRepository: MongoRepository<Fortune>,
+  ) {}
+
+  singleQuery() {
+    const rand = Math.floor(Math.random() * 10000) + 1;
+    return this.worldRepository.findOne({ id: rand });
+  }
+
+  async multiQueries(queries: string) {
+    const number = Math.min(Math.max(parseInt(queries) || 1, 1), 500);
+    const promisesArray = [];
+
+    for (let i = 0; i < number; i++) {
+      promisesArray.push(this.singleQuery());
+    }
+
+    const worlds = await Promise.all(promisesArray);
+    return worlds;
+  }
+
+  async fortunes() {
+    const allFortunes = await this.fortuneRepository.find();
+    allFortunes.push({
+      id: 0,
+      message: 'Additional fortune added at request time.',
+    });
+
+    allFortunes.sort((a, b) => (a.message < b.message ? -1 : 1));
+    return { fortunes: allFortunes };
+  }
+
+  async updates(queries) {
+    const number = Math.min(Math.max(parseInt(queries) || 1, 1), 500);
+    const worlds = [];
+    const bulk = this.worldRepository.initializeUnorderedBulkOp();
+
+    for (let i = 0; i < number; i++) {
+      const worldToUpdate = await this.singleQuery();
+      worldToUpdate.randomNumber = Math.floor(Math.random() * 10000) + 1;
+      worlds.push(worldToUpdate);
+      bulk
+        .find({ id: worldToUpdate.id })
+        .update({ $set: { randomNumber: worldToUpdate.randomNumber } });
+    }
+
+    await bulk.execute();
+    return worlds;
+  }
+
+  async cachedWorlds(count) {
+    const number = Math.min(Math.max(parseInt(count) || 1, 1), 500);
+    const promisesArray = [];
+    for (let i = 0; i < number; i++) {
+      promisesArray.push(this.singleQuery());
+    }
+
+    const worlds = await Promise.all(promisesArray);
+    return worlds;
+  }
+}

+ 10 - 0
frameworks/TypeScript/nest/src/mongo/world.entity.ts

@@ -0,0 +1,10 @@
+import { Column, Entity, ObjectIdColumn } from 'typeorm';
+
+@Entity('world')
+export class World {
+  @ObjectIdColumn()
+  id: number;
+
+  @Column()
+  randomNumber: number;
+}

+ 0 - 0
frameworks/TypeScript/nest/src/fortune.entity.ts → frameworks/TypeScript/nest/src/sql/fortune.entity.ts


+ 8 - 8
frameworks/TypeScript/nest/src/app.controller.ts → frameworks/TypeScript/nest/src/sql/sql.controller.ts

@@ -7,11 +7,11 @@ import {
   Render,
   Render,
   UseInterceptors,
   UseInterceptors,
 } from '@nestjs/common';
 } from '@nestjs/common';
-import { AppService } from './app.service';
+import { SqlService } from './sql.service';
 
 
 @Controller()
 @Controller()
-export class AppController {
-  constructor(private readonly appService: AppService) {}
+export class SqlController {
+  constructor(private readonly sqlService: SqlService) {}
 
 
   @Get('/json')
   @Get('/json')
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
@@ -23,26 +23,26 @@ export class AppController {
   @Get('db')
   @Get('db')
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
   getSingleQuery() {
   getSingleQuery() {
-    return this.appService.singleQuery();
+    return this.sqlService.singleQuery();
   }
   }
 
 
   @Get('queries')
   @Get('queries')
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
   getMultiQueries(@Query('queries') queries) {
   getMultiQueries(@Query('queries') queries) {
-    return this.appService.multiQueries(queries);
+    return this.sqlService.multiQueries(queries);
   }
   }
 
 
   @Get('fortunes')
   @Get('fortunes')
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
   @Render('fortunes.hbs')
   @Render('fortunes.hbs')
   getFortunes() {
   getFortunes() {
-    return this.appService.fortunes();
+    return this.sqlService.fortunes();
   }
   }
 
 
   @Get('updates')
   @Get('updates')
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
   getUpdates(@Query('queries') queries) {
   getUpdates(@Query('queries') queries) {
-    return this.appService.updates(queries);
+    return this.sqlService.updates(queries);
   }
   }
 
 
   @Get('plaintext')
   @Get('plaintext')
@@ -56,6 +56,6 @@ export class AppController {
   @Header('Server', 'NestJS')
   @Header('Server', 'NestJS')
   @UseInterceptors(CacheInterceptor)
   @UseInterceptors(CacheInterceptor)
   getCachedWorlds(@Query('count') count) {
   getCachedWorlds(@Query('count') count) {
-    return this.appService.cachedWorlds(count);
+    return this.sqlService.cachedWorlds(count);
   }
   }
 }
 }

+ 5 - 5
frameworks/TypeScript/nest/src/app.module.ts → frameworks/TypeScript/nest/src/sql/sql.module.ts

@@ -1,8 +1,8 @@
 import { CacheModule, Module } from '@nestjs/common';
 import { CacheModule, Module } from '@nestjs/common';
 import { TypeOrmModule } from '@nestjs/typeorm';
 import { TypeOrmModule } from '@nestjs/typeorm';
-import { AppController } from './app.controller';
-import { AppService } from './app.service';
 import { Fortune } from './fortune.entity';
 import { Fortune } from './fortune.entity';
+import { SqlController } from './sql.controller';
+import { SqlService } from './sql.service';
 import { World } from './world.entity';
 import { World } from './world.entity';
 
 
 @Module({
 @Module({
@@ -11,7 +11,7 @@ import { World } from './world.entity';
     TypeOrmModule.forFeature([World, Fortune]),
     TypeOrmModule.forFeature([World, Fortune]),
     CacheModule.register(),
     CacheModule.register(),
   ],
   ],
-  controllers: [AppController],
-  providers: [AppService],
+  controllers: [SqlController],
+  providers: [SqlService],
 })
 })
-export class AppModule {}
+export class SqlModule {}

+ 1 - 1
frameworks/TypeScript/nest/src/app.service.ts → frameworks/TypeScript/nest/src/sql/sql.service.ts

@@ -5,7 +5,7 @@ import { Fortune } from './fortune.entity';
 import { World } from './world.entity';
 import { World } from './world.entity';
 
 
 @Injectable()
 @Injectable()
-export class AppService {
+export class SqlService {
   constructor(
   constructor(
     @InjectRepository(World)
     @InjectRepository(World)
     private readonly worldRepository: Repository<World>,
     private readonly worldRepository: Repository<World>,

+ 0 - 0
frameworks/TypeScript/nest/src/world.entity.ts → frameworks/TypeScript/nest/src/sql/world.entity.ts


+ 6 - 12
frameworks/TypeScript/nest/tsconfig.json

@@ -2,22 +2,16 @@
   "compilerOptions": {
   "compilerOptions": {
     "module": "commonjs",
     "module": "commonjs",
     "declaration": true,
     "declaration": true,
-    "noImplicitAny": false,
     "removeComments": true,
     "removeComments": true,
-    "noLib": false,
-    "allowSyntheticDefaultImports": true,
     "emitDecoratorMetadata": true,
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
     "experimentalDecorators": true,
-    "target": "es6",
+    "target": "es2017",
     "sourceMap": true,
     "sourceMap": true,
     "outDir": "./dist",
     "outDir": "./dist",
-    "baseUrl": "./src"
+    "baseUrl": "./",
+    "incremental": true,
+    "skipLibCheck": true
   },
   },
-  "include": [
-    "src/**/*"
-  ],
-  "exclude": [
-    "node_modules",
-    "**/*.spec.ts"
-  ]
+  "include": ["src/**/*"],
+  "exclude": ["node_modules", "dist"]
 }
 }