Purpose - pcimino/nodejs-restify-mongodb GitHub Wiki

Purpose

My web background is mostly Java and Java frameworks like Spring. I've done a little Node.js and functional JavaScript before, but to really dive in I wanted to create a Node.js RESTful API project that's easy to understand and reuse. So I wanted to:

  • Configure a server with a REST api
  • That connects to a Mongo database
  • And provides some form of authentication/authorization
  • And a way to serve static pages to demonstrate the APIs
  • Create something that can be used as a backend for my next project using MVC project

This example was extremely helpful. In fact if all I wanted to do was setup a Node.js server I'd be done. But copying something wholesale doesn't help me learn about the underlying technology.

I also decided to go with Restify instead of Express (briefly looked at PerfectAPI which looks interesting). If I want to focus on REST then maybe Restify would be a little stricter and have less overhead? That's a question, since this isn't an opinion but an uneducated hunch on my part.

I looked at Everyauth and Passport. I decided on Passport, and after implementing code that looks suspiciously like Bill Heaton's example, I rolled back and removed it. Not because Passport isn't excellent, but because the stateless nature of Restify means I have to think about how to figure out if a request is truly authenticated or not.

Next: Disclaimer

Return Home