Getting start Nodejs in Heroku.

Getting start Nodejs in Heroku.

Heroku is a great tool for someone who need to build quick demo or some website that auto scalable. don't involve to much about server side. very few command and you good to go. today i will show you how quick it is to getting start Nodejs in heroku :)

First. you need to download heroku tool from this page. Download Heroku. Then install it in you computer

After you install success. you can open you command shell. and type this command

$ heroku

* you don't need to type $ in command. this symbol tell you this is command.

if you see list of command like picture below. you good to go.

Next let login into heroku use this command.

$ heroku login

Then type email and password. if successfully login you will see this response

Logged in as <youemail>

check node version. this tutorial working with node version greater that 4 you can use this command for check it.

$ node -v
v8.4.0

check are npm installed? normally it will install with node if not please install npm first

$ npm -v
5.3.0

check are git installed? if not you need to install git first(look at Installing Git). we need to use git to push our code to heroku.

$ git --version
git version 2.10.1

next heroku prepare getting start project for us. you can clone it from github into you local computer.

$ git clone https://github.com/heroku/node-js-getting-started.git
$ cd node-js-getting-started

let deploy the app. with simple command

$ heroku create
Creating app... done, ⬢ stormy-thicket-11258
https://stormy-thicket-11258.herokuapp.com/ | https://git.heroku.com/stormy-thicket-11258.git

heroku will create app and link it to you remote git. now you need to deploy it in heroku server by this command.

$ git push heroku master

Make sure you have at least 1 instance are runing. you can use this command

$ heroku ps:scale web=1

now you can open url that show when you create heroku. or use simple command

$ heroku open

Let see in our browser.

Hoorayyyy it working!!!. very easy right? in face you can follow documentation of heroku. very simple and easy to understand. if you want to read more. see Getting Started on Heroku with Node.js

Next time. i will show you how to integrate with Line login. it gonna be fun :))



To view or add a comment, sign in

More articles by Narongsak K.

Others also viewed

Explore content categories