0

I have a node.js app that is intended to be running all the time. Is a core process that does some specific work for each of our clients.

Today, that app is feed with the clients data by a config (json) file on startup, every time we need to add/remove a client or change a client data, we edit the json and kill/restart the app.

I came with the idea of building another node.js app that should work as a cli to send instructions to the main app, I don't know where to start, is there a solution already for this? I tought of using sockets to connect the app with the cli, but I feel it overkill. What's the propper way of controlling a node.js app from another node.js app?

I know this question may be vague and leaves space for discussions and opinions, but I don't know where to start looking for, all my searches give me express.js or forever/pm2 articles.

Alvaro Castro
  • 811
  • 1
  • 9
  • 26

1 Answers1

0

You could try storing your data in a REDIS DB and subscribing to changes from the node applications. So, you could update the redis and the configuration changes trigger automatically from within node application

See this question

Another method is to emit global events from your CLI and have your apps listen to and update their code as required.