Why do we need DTOs and interfaces both in NestJS

According to the Nestjs docs: But first (if you use TypeScript), we need to determine the DTO (Data Transfer Object) schema. A DTO is an object that defines how the data will be sent over the network. We could determine the DTO schema by using TypeScript interfaces, or by simple classes. Interestingly, we recommend using … Read more

Is there a recommended way to update NestJS?

You can use the Nest CLI to update the dependencies: $ npm install -g @nestjs/cli $ nest update You can also $ nest u As Mick mentioned in his comment, you might have to add –force argument. nest update –force Update – July 7 2022 Since v9.0.0 release, the command update was removed. To upgrade … Read more

nestjs vs plain express performance

UPDATE – 17.03.2020 We are now running benchmarks for every new PR. One of the latest benchmarks can be found here: https://github.com/nestjs/nest/runs/482105333 Req/sec Trans/sec Nest-Express 15370 3.17MB Nest-Fastify 30001 4.38MB Express 17208 3.53MB Fastify 33578 4.87MB That means Nest + FastifyAdapter is now almost 2 times faster than express. UPDATE – 22.09.2018 Benchmarks directory has … Read more

TypeORM Entity in NESTJS – Cannot use import statement outside a module

My assumption is that you have a TypeormModule configuration with an entities property that looks like this: entities: [‘src/**/*.entity.{ts,js}’] or like entities: [‘../**/*.entity.{ts,js}’] The error you are getting is because you are attempting to import a ts file in a js context. So long as you aren’t using webpack you can use this instead so … Read more