Connecting FeedHenry to Fuse REST Quickstart
This guide demonstrates step-by-step how to connect a FeedHenry Hello World application to a JBoss Fuse REST quickstart backend running on Red Hat’s OpenShift Online.
Here are a few assumptions before you begin:
- You've already completed the guide in my previous blog about creating a FeedHenry Hello World project
- You've already completed the guide in my previous blog about creating a Fuse REST quickstart project on OpenShift
Once you’ve completed the prerequisite blog guides, connecting the two is a simple matter of modifying a few files. You can even use the browser based editor so you can do everything online.
Log into your FeedHenry domain and find your previously created Hello World project.
Step 1: Modify the Hello World Cloud App
First, you’ll modify the cloud app files. Click on the “Cloud App“ panel shown below.
Next, click on the “Editor“ button in the column on the left.
Edit the /package.json
file and add a dependency for “xml2js“ version “~0.4.8“ to the end of the dependencies section. If you’d like, you can copy/paste the entire contents from the text below.
1 | { |
Next, edit the /lib/hello.js
file and replace its contents with the text below. Make sure to replace the uri field in both the get and post methods with the URI to your Fuse REST quickstart that you created in the previous guide.
1 | var express = require('express'); |
Finally, edit the /README.md
file and change the sample request body to “123“ instead of “world“. If you’d like, you can copy/paste the entire contents from the text below. This step is optional, but is nice to do since it will allow you to test directly from the “Docs“ page.
1 | # FeedHenry Hello World MBaaS Server |
Now, save all of the files and click on the “Deploy“ button in the column on the left.
That should bring you to the “Deploy“ page. Click on the “Deploy Cloud App“ button.
Deployment should take less than 1 minute. You will be shown a progress bar and status text box.
When the deploy process is complete, you will see a green progress bar and no errors in the status text box.
Once everything deploys successfully, you can click on the “Docs“ button in the column on the left.
This will take you to the test page for your app. It should look like the picture below.
Click on the “Try it!“ button to expand the request & response text boxes.
Click on the “Submit“ button to invoke the service. You should see a successful response like the one pictured below.
Step 2: Modify The Hello World Cordova Light App
Now, you’ll modify the Cordova application files. Click on the “Cordova Light App“ panel shown below.
Next, click on the “Editor“ button in the column on the left.
Edit the /www/index.html
file and replace the placeholder text for the input box with “Enter Your ID Here.“. If you’d like, you can copy/paste the entire contents from the text below.
1 |
|
Don’t forget to save the file. The simulator on the right should automatically update. Don’t worry if it doesn’t. Sometimes it needs a page refresh. However, since the changes we made were purely cosmetic, it doesn’t really matter if you see the update.
Enter “123“ into the input box on the simulator and click “Say Hello From The Cloud“.
If everything was successful, you should see a response like the one pictured below.
Now you’ve successfully wired your FeedHenry Hello World project to a backend Fuse REST quickstart running on OpenShift.
Connecting FeedHenry to Fuse REST Quickstart
https://blog.joshdreagan.com/2015/05/08/connecting_feedhenry_to_fuse_rest_quickstart/