Report this

What is the reason for this report?

How to deploy a NodeJS/Express REST API on digital ocean?

Posted on February 9, 2022

I have a simple web app that includes a backend REST api built with NodeJS/Express running on my local machine. It has standard CRUD operations, frontend makes api calls to backend etc. nothing fancy. I want to host this on digital ocean. What is the easiest way to do this? I found this example but I’m not sure if this is all still required or is this old? Is NGINX required?

https://coderrocketfuel.com/article/create-and-deploy-an-express-rest-api-to-a-digitalocean-server#set-up-nginx-as-a-reverse-proxy

I also found this that is shorter, but I’m not sure if it is missing important parts:

https://www.digitalocean.com/community/tutorials/how-to-host-a-node-js-app-on-digital-ocean

Any help appreciated. I think at the very least I must create a database and a droplet. Anything else?

Thank you~



This textbox defaults to using Markdown to format your 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.

Hey,

To deploy this on a Droplet you should be able to just follow the steps here:

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

This covers all of the required steps to have your Node.js app production ready on a Droplet.

With a Droplet, you will need Nginx in order to be able to configure an SSL certificate.

An alternative option here, is to use the DigitalOcean App Platform so that you would not have to do any server configuration and maintenance steps:

https://docs.digitalocean.com/products/app-platform/reference/buildpacks/nodejs/

- Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.