16
Deploy Node.js application in Heroku using Eclipse Jitendra Zaa

Deploy Node.js application in Heroku using Eclipse

Embed Size (px)

DESCRIPTION

Deploy Node.js application in Heroku using Eclipse

Citation preview

Page 1: Deploy Node.js application in Heroku using Eclipse

Deploy Node.js application in Heroku using Eclipse

Jitendra Zaa

Page 2: Deploy Node.js application in Heroku using Eclipse

Youtube Video URLhttp://youtu.be/jVkG9Kb07fc

Page 3: Deploy Node.js application in Heroku using Eclipse

Tools and TechnologyLanguage – Node.jsPlatform – HerokuGit – Bitbucket using SSH keyIDE – Eclipse

Eclipse Plugins Egit Heroku NodeEclipse

Page 4: Deploy Node.js application in Heroku using Eclipse

Setup Bitbucket (Optional)

Page 5: Deploy Node.js application in Heroku using Eclipse

Setup SSH Key in Bitbucket and HerokuCreate RSA SSH Key from Eclipse.

Save that key in BitBucket as well as Heroku.

Explained in article link provided in next slides.

Page 8: Deploy Node.js application in Heroku using Eclipse

Creating Blank Heroku ApplicationIn Eclipse, Click on Create New Project

And select Heroku, assuming you have already installed Heroku plugin in Eclipse.

Refer article explained in starting of this presentation

Page 9: Deploy Node.js application in Heroku using Eclipse

Create sample Node.js startup FileCreate Web.js file with following code

var express = require("express");var logfmt = require("logfmt");var app = express();

app.use(logfmt.requestLogger());

app.get('/', function(req, res) { res.send('Hello World!');});

var port = Number(process.env.PORT || 5000);app.listen(port, function() { console.log("Listening on " + port);});

Page 10: Deploy Node.js application in Heroku using Eclipse

Create Package.jsonOpen root application path in console

Run “npm init” command and provide all information

Now run below commandnpm install express logfmt --save

Page 11: Deploy Node.js application in Heroku using Eclipse

Create Package.jsonAdd below entry in generated package.json

{ "engines": { "node": "0.10.x" }}

Page 12: Deploy Node.js application in Heroku using Eclipse

Create ProcfileOnly one line needs to enter

web: node Web.js

Page 13: Deploy Node.js application in Heroku using Eclipse

Commit to GitFirst Commit to Local

Then

Heroku

Page 14: Deploy Node.js application in Heroku using Eclipse

Assign Dyno to your applicationA dyno is a lightweight container running a

single user-specified command

Assign 1 Dyno to your Heroku application which is free

Page 15: Deploy Node.js application in Heroku using Eclipse

How to check logs on HerokuNavigate to your Node.js application folder

and run below command :

Heroku logs

Page 16: Deploy Node.js application in Heroku using Eclipse

Test your application

Thanks