Upload
jitendra-zaa-
View
810
Download
0
Embed Size (px)
DESCRIPTION
Deploy Node.js application in Heroku using Eclipse
Citation preview
Deploy Node.js application in Heroku using Eclipse
Jitendra Zaa
Youtube Video URLhttp://youtu.be/jVkG9Kb07fc
Tools and TechnologyLanguage – Node.jsPlatform – HerokuGit – Bitbucket using SSH keyIDE – Eclipse
Eclipse Plugins Egit Heroku NodeEclipse
Setup Bitbucket (Optional)
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.
Introduction to EGitCheck this article :http://www.shivasoft.in/blog/salesforce/salesf
orce-git-eclipse-egit-better-and-distributed-source-control/
Introduction to Heroku PluginCheck this – http://www.shivasoft.in/blog/java/creating-firs
t-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
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);});
Create Package.jsonOpen root application path in console
Run “npm init” command and provide all information
Now run below commandnpm install express logfmt --save
Create Package.jsonAdd below entry in generated package.json
{ "engines": { "node": "0.10.x" }}
Create ProcfileOnly one line needs to enter
web: node Web.js
Commit to GitFirst Commit to Local
Then
Heroku
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
How to check logs on HerokuNavigate to your Node.js application folder
and run below command :
Heroku logs
Test your application
Thanks