Skip to content

Latest commit

 

History

History
81 lines (52 loc) · 1.98 KB

File metadata and controls

81 lines (52 loc) · 1.98 KB

OnPrem - NodeJS Mock CRM

This CRM is a NodeJS mockup of a potential on-premise CRM for demo purposes. The CRM is updated when the MessageHub consumer calls the rest api's to create the new customers and visits. It then syncs with DashDB by immediately writing the new customers and visits to DashDB.

What you will learn on this guide

  • How to setup DashDB config in the Mock CRM
  • How to run the Mock CRM on your Machine
  • How to test CRM

Requirement of this guide

Guide

Configure OnPrem CRM

1 - Open the dasdhdb-credentials.json file

cd MotoCorpService/CRM

2 - Set DashDB credentials as found in your Bluemix instance dashdb-credentials

Running the NodeJS CRM locally

1 - Install any dependencies

npm install

2 - Run the CRM locally

node app.js

To use SecureGateway later in the lab, it is recommended to run the CRM behind a firewall.

Testing the CRM

In the command line, you can test the CRM.

1 - To create a customer

curl -X POST -H "Content-Type: application/json" -d '{ "Name": "John Doe", "LicensePlate": "ABC-123","Make":"Honda", "Model":"CRV", "VIN":"12345667" }' "http://localhost:8000/customers/" -vv

Go into your DashDB Customer table to confirm a customer record was created.

customer table

2 - To create a visit

curl -X POST -H "Content-Type: application/json" -d '{  "date": "2016-06-23",  "type": "oil visit",  "comment": "hello this is a comment"}' "http://localhost:8000/customers/1/visits" -vv

Go into your DashDB Visit table to confirm a visit record was created.

visit table

3 - To list all customers

curl -X GET http://localhost:8000/customers -vv

4 - To list all visits

curl -X GET http://localhost:8000/customers/1/visits/ -vv

Next guide

BMX-SecureGateway