IBMDeveloperMEA / Connect-a-secure-Cloudant-database-instance-to-your-web-application

In this workshop you will learn how to connect your IBM Cloudant instance with your application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect a secure Cloudant database instance to your web application

IBM Cloudant is a fully managed JSON document database that offers independent serverless scaling of provisioned throughput capacity and storage. Cloudant is compatible with Apache CouchDB and accessible through a simple to use HTTPS API for web, mobile, and IoT applications.

In this workshop you will learn how to connect your IBM Cloudant instance with your application.

Prerequisites

Step 1: Sign-up/Login to IBM Cloud

1.1- If you are an existing user, click on this link to Login:http://ibm.biz/jtcloud

And if you are not, don't worry! We have got you covered! There are 3 steps to create your account on IBM Cloud:

1.2- Put your email and password.

1.3- You get a verification link with the registered email to verify your account.

1.4- Fill the personal information fields.

** Please make sure you select the country you are in when asked at any step of the registration process.

image

Step 2: Download Sample code

Download the sample app From workshop's Git Repository click on code and download zip file. Unzip the file to a path of your choice.

Step 3: Create an instance of Cloudant

3.1 - Fron Dashboard search for Cloudant service in catalog and select

1

3.2 - Click on create. You will be re-directed to your IBM Cloud Dashboard, select Cloudant from resource list.

2

Step 4: Create Credentials

4.1 - We will need credentials in order to connect Cloudant service with our sample app. To create credentials, from Cloudant service window, select Service credentials from the left menu. Click the New credential (+) button

3

4.2 - Give a name for your credentials and click on add

4

Step 5: Create Database

5.1 - Go to manage, Click on Launch Dashboard

6

5.2 - From Cloudant Dashboard select, create database, name your database "shopping_list", click create

7

5.3 - Notice that right now your database is empty

9

Step 6: Create service credentials config file

6.1 - Open your sample app in your editor (mine is Atom), create a new file, paste in the below code and save it as :"vcap-local.json" in config directory.

{

  "services": {

  "cloudantNoSQLDB": {

  "credentials":

  PASTE CREDENTIAL INFO HERE

  ,

  "label": "cloudantNoSQLDB"

  }

    }

    }

8

6.2 - From Cloudant service window (where you created your credenttials in step 4), copy credentials

5

6.3 - In vcap-local.json, replace the "PASTE CREDENTIAL INFO HERE" with the credentials you’ve just copied.

10

Step 7: Load application data into Cloudant Database

7.1 - To load data in your Cloundant database run the following commands

  npm install

  npm run load-db

Workshop Resources

Login/Sign Up for IBM Cloud: http://ibm.biz/jtcloud

Workshop Replay: https://www.crowdcast.io/e/journeytocloud1

Done with the workshop? Here are some things you can try further

Links to the next sessions in "Journey to Cloud"

29th November- 6PM-8PM (GMT+4)

2nd December- 6PM-8PM (GMT+4)

6th December- 6PM-8PM (GMT+4)

8th December- 6PM-8PM (GMT+4)

About

In this workshop you will learn how to connect your IBM Cloudant instance with your application.