My background is in Java where I build web services and APIs. My main job as an API developer is to move, organize, combine, and publish data. I found the MEAN stack is a great way to prototype and build APIs with a flexible document-based data store. Finding ways to include Node as an option in my technology stack is also a plus for me.
The truth is, I started experimenting with a MEAN project because of a failed certification test. It was a typical technology exam: study, memorize, practice, and hope for the best. Unfortunately this test had no practice exam to help flesh out potential questions. Frankly, it’s also a topic that wasn’t particularly interesting, but still essential for me to prove knowledge.
The study guide for this exam was a list of general subject areas and three or four, off the shelf, books as suggested reading. So while I’m in the cooldown period to try again, I took a sidetrack into something more interesting and trying to make my studying easier. I wanted to build an app with some realistic questions that I could study in flash card style. Basically, it was an effort to create a practice exam.
The next series of posts will document the steps I took to set up the stack, create the API, and build the client. The client is a single-page application that lets the user create the data set and run through the practice flash cards.
What is the MEAN stack?
Solution stacks represent a complete suite of technical components used together for applications and services. For example, a typical web application requires a web server, a client interface, and a persistent data store. MongoDB provides the persistent data store. Express.js provides the HTTP engine to service both API and client requests. AngularJS is key for our data-driven client. Finally, Node.js provides the foundation for a data API.
There are different packages that can help you get up and running with the mean stack. MEAN.io and MEAN.JS offer a template system and scaffolding to get started. The approach I wanted take was to walk through an example using an enterprise ready MEAN framework, StrongLoop.
StrongLoop is a tool I learned about at a Node.js meetup about two years ago but never explored with clients. At the time, I was impressed with how quickly you could craft an API that allowed you to build and store simple JSON data. To be honest, coming from building relational data services and integrating with strict SOAP schemas using Java and Spring, it blew my mind how easy it was to throw data at an API and have it stick. That’s the beauty and challenge of a document based data store.
The StrongLoop scaffolding provides project creation and management tools like the other packages. It also provides enterprise capable API management and monitoring services. Since my introduction at that meetup, IBM acquired StrongLoop and did a soft rebrand as API Connect. This is a good move for StrongLoop and gives them more enterprise cred with IBM. My experience so far is just as slick as I remember. I really hope to see more of them in the future. My example covers the basic scaffolding, API design, and creation using StrongLoop. I haven’t explored the API management tools that set them apart. I’ll save that topic for another time.
Step 1: Building an API with StrongLoop.