Tuesday, 14 January 2020

Is it bad practice to have an nodejs job running alongside an nodejs api, that to say, sharing models and libraries.

I have to do an job to run an task once every day, the task I need to do is like 20 lines of code, if I use the models that I already wrote for the API, instead of copying all the models and creating two codebases with the exaclty the same code, and if I changed one, I would need to remember to change another, I decided to put the job alongside the API, so both run and make use of the models folder.I don't know if this is a bad practice. I thought about outsourcing my job code into an API endpoint and then calling this endpoint once every day. Is this the best approuch for this problem?

Submitted January 14, 2020 at 05:35PM by eliseu_videira

No comments:

Post a Comment