Skip to content

Tag: node.js

How to create dto of an complex object in NestJs

I’m a beginner at NestJs and I want to create a dto of the following struct: I want to create an API that can return this object using DTOs. I tried the following dto but I got an error in the service provider : I create 3 classes OneSessionResponseDto, SessionsResponseDto, and WeekResponseDto so I can …

JSON empty when is called from another file

I’m learning NodeJS and MongoDB. I dont know what is happening with this function. If I make a console.log before return user, it works fine (just print an JSON array with all info of the collection) The problem is when I call it from another file (in my case, the router). If I do this, I receive an emp…

Invalid array length allocation failed

I have the following script: Output I’m receiving this error when trying to run my JS: FATAL ERROR: invalid array length Allocation failed – JavaScript heap out of memory I’ve checked other similar posts that say to increase the memory size f.x., node –max-old-space-size=16000 yourFile…