2

I am very new to node and I have a small node application (mysql database integration) on whose output another JavaScript class in my main application depends. Are there some ways to execute my node app then automatically once my main program is invoked (without using a 'node' command and the command line at all)?

In particular, my main program provides some functionality for a web app's interactivity and my desired aim is to be able to start and run my node app automatically once some particular actions are done within my main application (therefore, it would be perfect to have some JavaScript code that automatically starts my node app).

Thanks in advance!

1
  • 1
    Either make it a module that you load directly into your application or use child_process.fork() Commented Sep 1, 2015 at 11:27

2 Answers 2

1

If you want to continue run your app without recompiling each time you change some value, simply use the Forever Module Which is for run the application forever.

Its very simple and easy to use.

You just install it with the npm. Type these commands in console.

npm install -g forever
forever start app.js           //your application main file name.

forever Documentation

Sign up to request clarification or add additional context in comments.

Comments

0

Why wouldn't you just deploy your producer app as standalone, and then provide an HTTP REST API to be used by whatever app needs to consume its output?

1 Comment

Yes, this idea sounds nice! :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.