Spark.js, Node.js and OpenShift Integration

Evening Everyone!

This is my first post here, but I have been using other posts as a resource for at least the last year or so. I have been working with OpenShift lately and have been trying to create a cartridge to help other get up and running quickly. I believe I have a good starting point and was hoping for some feedback.

Most of the details are on my webpage.

If anyone has used OpenShift for Node.js, MongoDB or other stuff, you are probably familiar with what I have done. I took the Node.js base cartridge and added all of the module and configurations needed to quickly spin up a page to interact with spark.io devices through a browser.

In the link above I inlcuded instructions on how to install the OpenShift cartridge and code to place on the spark.io device to test it out.

It boils down to creating an OpenShift account, create a new application with this cartridge: http://cdk-hippreality.rhcloud.com/manifest/master and place some code on your device to work with.

Hopefully anyone working on trying to integrate node.js, spark.js and everything else will find this helpful.

4 Likes

Also, here is an example of what the cartridge page looks like. http://sparknodedemo-hipptest.rhcloud.com/

1 Like

For some reason it doesn’t do anything after I entered my credentials. The modal stays open, yet nothing happens.
Other question: in this case, where does the whole Node.js part come into play? The functionalities as they are on that page can be created with the SparkJS library alone. Purely out of interest, since I’m trying to build a dashboard for my Sparks, using the MEAN stack with SparkJS.

I will have to look into why the login is not working for you. Which browser did you use and did it throw any errors? I have just tried it in Chrome and it does seem to work right now.

I have used node.js with express and jade to leverage (and learn) the how to use routes, templates and the rest of the cool stuff it comes with. It is obviously overkill for this example, but in the future there could be a fully functioning site with spark.io functions and outputs intergrated through out.

It was also an experiment to use the OpenShift Cartridge Development kit to create an asset people could just deploy and start working with.

Let me know if you had errors and I will look into why it may not be working. Thanks for trying it out!

PS. I normally only get a few hours a night to work on this stuff, but I will do my best to reply at least once a day.

Ah, the wonders of modern technology, it seems like the issue resolved itself. There were no errors, but it just didn’t respond when you clicked “log in”. The model stayed open, and nothing seemed to happen. I was hoping for some console logs, but there weren’t any, so I don’t think there were any errors. Perhaps my browser was misbehaving (Opera).

I understand why you’d like to use NodeJS (and all fancy things that work with it). Was just trying to make sure you weren’t over-engineering this page. To try things out though, its great :smile: Looking forward to what it will become! I’d also suggest you take a look at meanjs.org, it’s a great boilerplate for the MEAN stack.