page-brochureware.php

Quick Start for Node.js on IBM Cloud

Introduction

It’s easy to get started with IBM Cloud. This tutorial will show you the fast path for using the IBM Cloud Developer Tools CLI on the command line or the web-based IBM Cloud App Service on the IBM Cloud dashboard to create and deploy a Node.js application. These tools enable you to generate a Node.js application on-demand, fully equipped with an Express server, integration with IBM Cloud Services, and deployment configurations for Cloud Foundry and IBM Container Service on IBM Cloud.


Using the CLI

The IBM Cloud Developer Tools CLI provides a command driven approach for creating, developing, and deploying a web project. It’s ideal for developers that would like to use command line control to develop end-to-end applications.

  1. Install prerequisites

    Use the following curl command to install git, docker, kubectl, helm and IBM Cloud Developer Tools CLI.

    curl -sL https://ibm.biz/idt-installer | bash

  2. Create

    Use the bx dev create command from IBM Cloud Developer Tools CLI to generate a pre-configured starter that fits your application needs.

    • Note: You need to be logged into an IBM Cloud account to create a project. If you do not have an account already, you can register for a free account. Use the bx login command to login on the command line.

  3. Deploy to IBM Cloud

    Use the bx dev deploy command to deploy to IBM Cloud as a Cloud Foundry application.



    Once the application is deployed, you can verify that it is running by viewing it’s health status. Recall the hostname that you assigned in step 2 and open a browser window to <your-hostname>.mybluemix.net/health.

Using the App Service

IBM Cloud App Service is an online console that makes it easy to quickly create and manage applications, configure and attach services (such as databases, notifications, and Watson), and monitor and deploy apps. You can use the App Service to deploy to IBM Cloud as a Cloud Foundry application, to IBM Container Service or through a DevOps toolchain.

  1. Create

    Use the IBM Cloud App Service to create a project:

    • From the Starter Kits page in the App Service, select a Starter Kit based on your chosen programming language. For example, for a Node.js application, go to Express.js Basic and click Select Starter Kit.
      • Note: You need to be logged into an IBM Cloud account to create a project. If you do not have an account already, you can register for a free account.
    • Enter your project name. For this tutorial, use nodeexample.
    • Enter a unique hostname, such as your initials plus -devhost This hostname will be used for your project’s route. For ex: abc-devhost.mybluemix.net
    • Select your language platform. For this tutorial, use Node.js.
    • Click Create Project. Your project will be generated.
    • Click Download Code to download your project to your local machine. Unzip it and cd into the root directory. You will need to complete the prerequisite step above, then continue to deploy below.

  2. Deploy to IBM Cloud

    Use the bx dev deploy command to deploy to IBM Cloud as a Cloud Foundry application.



    Once the application is deployed, you can verify that it is running by viewing it’s health status. Recall the hostname that you assigned in step 1 and open a browser window to <your-hostname>.mybluemix.net/health.



Next Steps

Congratulations! You now know how to create a Node.js application and deploy it to IBM Cloud. For more info, check out our other tutorials: