I'd like to build a React application where the app continually pulls throughout the day from 7 different APIs (even when nobody is online) and sends automated messages when receiving a given value. Would it be possible to do this only with React or is Node.js required? If so how would you do it?
Some key points:
- JS is single thread in most cases. When you say daemon, typically, we are talking about a separate thread or process. So this is not doable with js typically especially in browser. But, to achieve your needs, you don't have to have a daemon. You just need to setup some timer in your js code and fires the requests when it's the time.
- If you want to call 7 different APIs just from frontend, then you may encounter cross-domain issue unless these APIs are legally opened by others and they don't prevent cross domain request.
- If you need the time to be very accurate, it's better to call the APIs on backend and cache the data you need. If you want to do so, then nodejs may be used depending on what language you are most familiar with. My suggestion is to do it on backend. It's easier to manage and you can implement real multi-thread or multi-process daemon.