Where to run business logic?

Where to run business logic?
0.0 0

#1

I’m trying to learn Javascript and NodeJS with Express. Done a few courses on Udemy etc. One thing I can’t get a good grip around is where to place custom “business logic”. All courses seem to focus on CRUD operations for the server.

Let’s say I would like to do a clone of something like runkeeper. Every now and then it seems like they scan the data for certain users and then generate email or push notifications based on the data. Where would I place this function/logic? Would it be reasonable to create a cron job in my nodejs server scheduling things like this? How would an experienced developer think?


#2

Things like this are usually done with database triggers:
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql
If you are monitoring something a cron job sounds like a good plan. I haven’t tried it myself though.