How to architect this node.js and angular app?

59 Views Asked by At

I'm pretty new to javascript, node and angular but have coded a lot in java before. I have been reading up for quite some time on services, factory, module, controllers and detectives but need some help.

I want to run a task every midnight to pull a json object and parse it.

I want to display the parsed data on the front end. It's a few timestamps and I have figured out how to print variables on html.

I need to run another task 5 times a day on the timestamps returned by the json object to play a sound.

How do I go about designing my application? I can currently create modules and controllers but I feel like this logic needs to be In a service or a factory but I'm not sure.

Alternatively, I have this logic coded in python and it works but I would like to keep my code clean and run it in angular/node. Your help architecting is appreciated. I can read and figure out how to program the rest

1

There are 1 best solutions below

5
On

I'm not sure about the part where you need to "schedule" this task to run 5 times a day, but here's an idea on how you can show the data in the front end: Use the concept of Observables. When you create you page, you can create an Observable. This Observable will be listening for a event from the backend. Once the backend emits the event, the Observable will notify all Objects that are subscribed to it. Then you can use the return with a ngIf directive to display a message in the frontend.