Showing posts with label bluemix. Show all posts
Showing posts with label bluemix. Show all posts

Wednesday, November 8, 2017

Developing Hello World applicafion for IBM Bluemix and IBM Node SDK

Image result for ibm bluemixImage result for node js


IBM Bluemix : For those of you who have not heard about IBM Bluemix, IBM Bluemix is the latest PAAS environment from IBM, which is based on open technologies like CloudFoundry, supporting various development languages and service. 

Before you go further reading a bit on IBM Bluemix would help : Bluemix Introduction
Bluemix supports lot of popular runtimes including Node.js which makes it platform of choice for all the recent deployements, customer demos etc. by my team. If you do not have a Bluemix account, you can register here : Registration for Bluemix


Node.js : Node.js uses the popular javascript language for server-side business applications, instead of the conventional client-side logic. Its based on an event-driven model, so you basically develop functions which can executed on occurrence of specific events. A great place to get started with Node.js and download all installers is the home page https://nodejs.org/en/. Download and install the version which matches your OS.


Lets get on with Developing a Hello World Application using IBM SDK Node.js and IBM Bluemix.

High Level Architecture of Hello World Application





Steps
  1.  You can use 2 ways to create Skelton Node js application and deploy it to Bluemix.
     
  2.   First way is to do it directly from IBM Bluemix Web Dashboard. Navigate to IBM Bluemix from your browser (https://console.bluemix.net)

  3. From Dashboard click on Create button, under apps section.

     
  4.  Select SDK for Node.js from the section Cloud Foundry Apps

  5.  Enter the AppName and you can leave rest of the boxes as default. Kindly note Host name would be the public route to your application.

  6.  That is it, our boilerplate Node application is ready and can be downloaded for any modifications.
  7. Second way is to create a sample node application locally and push it to bluemix.

  8.  Use the npm init command to create the node project skelton.

  9. Next install express dependency locally in your project using the command npm install express
  10. Create your main javascript file, named app.js.
    This can be done through command
    touch app.js.
  11. Content of your app.js could be
    var express = require('express');
    var app = express();
    app.get('/', function(req, res){
                    res.send('Hello World');
    });
    app.listen(8080);
    console.log("Sample Node application is now running on port 8080");

  12. You can test this application locally by running it on local node server, using the command
    node app.js


  13. You can open the application in browser through url : http://localhost:8080/


  14. 1.       Now let’s push this app to our Bluemix server, you can use below commands
                      a.       bluemix login  -o user@ibm.com -s dev -sso
    b.       Get the one time code and paste in back for authentication to proceed.
    c.       bluemix app push bluemixnodesampleapplication



     



Merging and Splitting PDF files

We all use and rely on PDF's. There are occasions though when you want to edit certain portions of a pdf and merge the edited version ba...