Hello, I am Bob Balfe, this blog is about how brand and content management is changing the eCommerce landscape. I also seldomly do book reviews and a few videos on YouTube.
Readers of my blog know I am a huge fan of Node-RED so now you can learn about it in the upcoming tech talk by IBM developerWorks. I most recently used Node-RED in an Eclipse application where I provide an automatic translation service for a tool called PET.
IBM developerWorks Open Tech Talk Node-RED
Categories: Cloud, Internet of Things
Node-RED is a tool for wiring together the Internet of Things in new and interesting ways, including hardware devices, APIs, and online services. Node-RED makes it easy to wire together real-world events, add in some intelligence, and access simple nodes to integrate them with existing messaging systems and social platforms such as Twitter, MongoDB, and Redis to create apps that can react to the world around them.. Learn more.
I have two servers, one application server (JSP based) and one WebSphere Commerce server. I want to be able to call the REST API’s on the Commerce server via JavaScript served up by the application server. So my JavaScript would look like this:
The problem is, if CORS is not enabled on the WebSphere Commerce server you will receive the infamous No ‘Access-Control-Allow-Origin’ header is present on the requested resource. And the call fails.
Now WebSphere Commerce can be a little tricky if your server has a web server in front of it. You essentially have to enable it in both places – or at least that is what I had to do. If I only had to do one of these please let me know – I got tired of testing the different tips from the netverse.
I have IHS in front of WebSphere Commerce, so, after hours of playing around with different configurations I came up with these steps:
First configure httpd.conf in the IHS/conf directory and add these lines if you want all domains to be able to access your data:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin"*"
Header set Access-Control-Allow-Methods "GET, PUT, OPTIONS"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
</IfModule>
Remember, you can always override the Access-Control-Origin with a domain or multiple domains to prevent access for everyone.
Next, you have to update the WebSphere Commerce server. You can actually see the Commerce Insights enabling documentation for this (my colleague pointed me to this, thanks J). You will be editing the WC configuration file and the WC Search configuration file.
Ok, I may be a little late to the game but recently I have been studying up on Facebooks/Instagrams React JavaScript library and I have to say I am fairly impressed with it. They say it is the V in MVC (model view controller). Outside of the fact that React applications can run both locally and on the server via Node (which I am sure you know I am a big fan of Node) it also comes with a React Native library!
React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about — learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native. – link
This means you can now truly “learn once and run everywhere”. The great news is you can start coding now on BlueMix. Check out this article to see how React Native can be developed and deployed on BlueMix. If you are doing a cool project using React or React Native send me a link to your post, I would like to check it out.