Start nodejs service from Tomcat

My goal is to deploy war file to Tomcat and start Tomcat my REST service.

Please note that this is a Tomcat application server and not an Apache web server, so all messages about mod_proxy and .htaccess will not work. I understand that node does not need Tomcat, that node is not servlets, that node includes an embedded web server, etc. It is a client that instructs to deploy a service to Tomcat via war file. Now I need to make it work.

Using "node myapp.js" from the command line, my rest service works fine on localhost: 3000 / terms. Then I stop the remaining server running locally and create a war file using grunt and war. The war file is deployed to Tomcat without issue. If I include "hello world" as index.html, then I can access this page at localhost: 8080 / myapp as expected. However, when I try to access the rest service from localhost: 8080 / myapp / terms, I get ERR_CONNECTION_REFUSED. I also tried to access the service at localhost: 3000 / timeline after deploying the Tomcat war.

I suspect Tomcat is not starting the rest node service when deployed.

How can I 1. use Tomcat to start a node service on startup like a servlet 2. Run a command prompt when deploying a war file so that I can use "Forever" 3. use a standard node module that I don't know about 4. any others ideas the community might have

After three days of searching on Google, I ran out of phrases and ideas. Thank you for any suggestions.



source to share

All Articles