Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Node.js REST API to production mode

I've created a REST API using Node.js and Express, so now I need to share it and publish it on a server in order to connect from Front-end. Can you tell me a proper way to do it?

like image 506
Камилов Тимур Avatar asked Oct 23 '25 16:10

Камилов Тимур


2 Answers

You could use Heroku for deployment, this way you can know how your app will fare. It's free moreover.
If you're satisfied with it then you can go ahead and buy a dyno or use other platforms like Azure or AWS.

To learn more on how to deploy your existing app to Heroku, visit this page.

like image 72
codejockie Avatar answered Oct 26 '25 06:10

codejockie


The question you are asking is very broad. It can be done in a lot of ways. For me this 2 part tutorial was very helpful: https://hackernoon.com/tutorial-creating-and-managing-a-node-js-server-on-aws-part-1-d67367ac5171. However, this only covers the installation on AWS EC2. This doesn't differ much from deploying it to Google Cloud, Azure or something local.

In general you need to fix the following steps:

1) Create a server somewhere (local or in the cloud)

2) Install all the stuff to run your app. In your case Node.js at least

3) Put a copy of your app on the server

4) Run it with node

5) Go to the ip of the server

The tutorial gives more details. DISCLAIMER: If you actually want to use this in production there is way more to consider. For example, security policies, setting up proxies, installing certificates etc. Please read up on that properly before you start running production apps.

like image 44
Imre_G Avatar answered Oct 26 '25 05:10

Imre_G



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!