Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 3.31 KB

File metadata and controls

15 lines (8 loc) · 3.31 KB

Location Tracker Part 3: Add a middle tier to manage users, with Node.js

In Part 1 of this tutorial series we learned why location is so important to modern mobile apps and how to build the basic functionality. In Part 2, we took that code and transformed it into a serious app using AngularJS. In both Parts 1 and 2, the Location Tracker application was deployed as a CouchApp. The cool thing about a CouchApp is that it can be hosted completely within Cloudant (since every Cloudant account comes with a tiny built-in web server). This makes CouchApps great for demo applications like the Location Tracker. As an added bonus, you can quickly fork a CouchApp by replicating it into your own Cloudant account and have a fully-functioning application up-and-running in under 60 seconds. However, there are limitations to CouchApps.

Without a middle tier, building certain functionality becomes a challenge. The typical three-tier architecture includes a data tier, an application (or logic) tier, and a presentation tier. CouchApps eschew the traditional application tier and just include a data tier (Cloudant or CouchDB) and a presentation tier (HTML5, CSS and JavaScript). While it's possible to build some application logic within Cloudant, there are practical limitations. This is because Cloudant is primarily intended to be used as a data layer, and putting too much application login on the presentation tier makes for messy, unmaintainable code.

Overview of a three-tier application including presentation tier, logic tier, and data tier

Let's take managing user access, for example. How would you go about building a user management system without an application tier? If you can figure out how to do this, I'd love to know! In Part 3 of this tutorial we build a Node.js application that handles user registration, login and logout. Also, because we need a new home for our growing app, we deploy Location Tracker to IBM Bluemix (this platform-as-a-service lets you quickly create, deploy, and manage applications on the cloud). Then, we'll update the map to display individual user locations, rather than one big map of all user locations.

If you want, dive in to the code right right now. Deploy the Location Tracker application to Bluemix by clicking the Deploy to Bluemix button. To read all the details, including a step-by-step explanation of what's involved when you deploy to Bluemix, instructions for running the application in your local development environment, and an explanation of how we manage user access in the Location Tracker application read the full tutorial.

Deploy to Bluemix

Location Tracker Tutorial: Part 3