Non Gamstop CasinosBet Sites Not On GamstopOnline Casinos Not On GamstopCasinos Not On GamstopCasinos Not On GamstopCasinos Not On GamstopNon Gamstop Casinos 2025

How to Deploy a NodeJS App in 2020

Nodejs is one of the most popular backend languages you can write your API in. On the browser, we are used to writing code with import/export syntax (ECMAScript modules) finally we can do the same with the newer versions of node. This article shows you how to deploy your NodeJS API online and how to update it with simple steps.

Getting Started With NodeJS

  1. Install git
  2. Install NodeJS (v14+)
  3. This guide requires a free GitHub account
  4. This guide requires a free KintoHub account

Deploy an App To The Cloud

The first thing we need to do is copy the example code onto your GitHub account. You can do this by going to the following repository and click Use this template at the top right.

https://github.com/kintohub-examples/nodejs-api

Image for post
Image for post

Once you have created the nodejs-api example within your Github account, login to your KintoHub account and do the following:

kintohub nodejs api settings
kintohub nodejs api settings
  1. Click on the Create Service at the top right
  2. Choose Backend API from the service type list
  3. Connect and give access to your nodejs-api on your Github account. Then select that repository.
  4. Change the Language from Dockerfileto NodeJS
  5. Select 14in the Language Version
  6. Set the Build Command to npm install
  7. Set the Start Command to npm run prod
  8. Set the port to 80
  9. Click Deploy at the top right.

After one minute, your app should be built and deployed and accessible with a URL at the bottom of the logs.

Image for post
Image for post
Woot! Deployment Successful!

Now click on the Public API and add /hello/strangerand you will get the following response :

{“message”:”Hello stranger”}

Update your NodeJS App

Now let’s say you want to make some changes to your app and you want to push an update to your users. First, we need to clone the code to your local machine. Make the changes, then push the new code.

  1. You need to clone the repo. Go to your Github repository and click on Code and then copy the URL
  2. Open a terminal and run git clone {paste-your-repo-url-here}
  3. Open up the index.js file and change /hello/ to /goodbye/
Image for post
Image for post
Required code changes

Test Your NodeJS App Locally

Before pushing any code, you must test it! To test your NodeJS app, run the following command.

  1. Run npm install
  2. Run npm start
  3. Open your browser to https://localhost:8000/goodbye/stranger and you should see a successful response.
Image for post
Image for post
App is ready to rock!

Now that we know your code works, you can push it to Github with the following commands:

git add . && git commit -m ":alien: refak(App): goodbye endpoint" && git push

Image for post
Image for post
We have successfully pushed our update to GitHub!

Deploy Your changes

Finally, we need to deploy the changes you just tested which should be working correctly. Go back to KintoHub and do the following.

Image for post
Image for post
  1. Click on your nodejs-api service
  2. Click Trigger Deploy at the top right.

After a minute, you should see again a successful message at the bottom with the URL to access. When you trigger a deployment on KintoHub, it does not take down your old version until your new version is live and traffic has been redirected to it. This is known as a no-downtime deployment.

What’s Next?

KintoHub comes packed with many additional features to debug and enrich your NodeJS App.

Conclusion

That’s it! Within a few minutes, you should have deployed and updated your NodeJS App. If you have any issues with this example or want to learn more, please join us on Discord. There are also more advanced guides that can be found here.

KintoHub

Deploy Cloud Native Apps In Seconds

Thanks to Nadeem Khedr. 

Joseph Cooper

Written by

Co-founder and CEO @ www.KintoHub.com | VP @ www.JungleeGames.com | Keyboard Ninja | Entrepreneur

KintoHub

Deploy Cloud Native Apps In Seconds

Joseph Cooper

Written by

Co-founder and CEO @ www.KintoHub.com | VP @ www.JungleeGames.com | Keyboard Ninja | Entrepreneur

KintoHub

Deploy Cloud Native Apps In Seconds

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store