Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
How to migrate some route DTO object in NestJ?

I use NestJS and my app have some changes in the DTO objects that is expects to receive in the controller. The client side is a mobile app and I can’t force the users to update version, so I might get DTO objects that might not be in the updated version that my server side expects to receive.

What I want to do is to take the object I get and if I see the object is received from older version of the client side then I want this object to be migrated to the updated object type.

What is the best approach to do this?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

A simple solution can be adding a field that indicates that the recived object is the DTO's updated version, check if that field exist or not, then apply the consequent logic.

Another way is to use the API versioning, you can find how to use it in the NestJS official documentation. This one I think is a better approach, this because if in the future you want to update again the DTO, you have only to create another controller version.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!