Vie. Abr 19th, 2024

I have tried IBM Bluemix PaaS for deploy a node application with a NoSQL database for free using its free plan (https://www.ibm.com/account/reg/us-en/signup?formid=urx-20295) and I have recorded a short video showing the steps for make this.

The detailed steps described in the video are the following (For Mac OS 10.13.3):

brew install cloudfoundry/tap/cf-cli
git clone https://github.com/IBM-Bluemix/get-started-node
cd get-started-node
npm install
npm start

You can view your app at http://localhost:3000.

cf api api.eu-gb.bluemix.net
cf login
cf push
cf apps

In your browser, log in to IBM Cloud and go to the Dashboard. Select your application by clicking on its name in the Name column.

Click Connections then Create connection.

In the Data & Analytics section, select Cloudant NoSQL DB and then create the service.

Select Restage when prompted. IBM Cloud will restart your application and provide the database credentials to your application using the VCAP_SERVICES environment variable.

If you want to use this database connection with your local environment I can tell you that this environment variable is available to the application only when it is running on IBM Cloud.

In the get-started-node directory, create a file called vcap-local.json with the following content:

{
 "services": {
 "cloudantNoSQLDB": [
 {
 "credentials": {
 "url":"CLOUDANT_DATABASE_URL"
 },
 "label": "cloudantNoSQLDB"
 }
 ]
 }
}

In your browser, go to IBM Cloud and select Apps > your app > Connections > Cloudant > View Credentials.

Copy and paste just the url from the credentials to the url field of the vcap-local.json file, replacing CLOUDANT_DATABASE_URL.

Run your application locally.

npm start

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *