The best deployment architecture for angularjs nodejs app

后端 未结 3 1873
無奈伤痛
無奈伤痛 2021-02-07 15:56

I have Moto Adverts application in angularjs and nodejs. Angularjs-client-side is running on Apache HTTP Server (localhost:8000) but nodejs-server-side is runnning as node.js ht

3条回答
  •  孤街浪徒
    2021-02-07 16:45

    I believe this is the most popular architecture for apache nodejs angularjs.

    (A) in the figure.

    I recommend for you to serve all files including static files via nodejs server as I wrote in my figure. On the other hand, you could use node server only for dynamic contents and use apache to serve static files including your client side codes if you like. But if you do so, you need apache server ALWAYS even when you develop your application. I feel that will be troublesome.

    (B) in the figure.

    You can serve your client side codes including other static files by locating them in public directory. If you decide to serve all files from nodejs server, you can develop without apache and avoid to write specific port number in your code. I think your application code should not be conscious about the port number you will use.

    I hope this could be answer for your all questions.

提交回复
热议问题