Question

Running Droplet with Python Flask and NodeJS

Hello all,

I am currently running a droplet with a Python Flask app, using Nginx. I am looking to add a NodeJS app to the droplet for a frontend. Is there any pitfalls to me doing this? I am relatively new to this side of computing, and am unsure of the best processes to follow.

I am also mostly unfamiliar with NodeJS, so I don’t know how the interactions work. Also is it possible to run two NodeJS apps together on one droplet? In the future I’d like to add another NodeJS app.

Thanks for any help and advice!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @RizLord,

There won’t be any issues, I can confirm this as this is something I’ve tried many many times. You can have as many and different apps as you won’t as long as you use free ports on your server for them.

Additionally, if you are already using Nginx, you can configure it as a reverse proxy for your App to the NodeJS’s port.

All in all, you are 70% complete with Nginx, you just need to configure NodeJS and your Nginx configuration to be used as a reverse proxy. You can take pointers from this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Regards, KFSys

Hey @RizLord,

Shouldn’t be a problem at all. Just make sure you run your node.js applications on different ports.

Use NGINX proxying functionality to point different routes to different ports.

Here’s an example:

location /route {
    proxy_pass  http://127.0.0.1:9999/;
}

Where 9999 is your node.js port.