0.5.0 • Published 10 years ago

ftybr v0.5.0

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

ftybr Build Status

I feel a pang of guilt. Because, as I refactored a little router out from another app, it slowly started to resemble Express/Connect.

At which point, I thought, "fuck it, I'll use it anyway."

So, my apologies for yet another router. I decided to call it follow the yellow brick road. Mostly because you'll melt if you use this router.

To create your router object:

var router = require('ftybr')();

You'll also need to add some routes. To add routes, you'll need to register a controller. Controllers are objects, of some form, that must have a .getRoutes() method. This method returns a multi-dimensional array that is used to build the routes.

router.registerController({
  getRoutes: function () [
    [ 'get', '/', function (obj, done) { done(null, { output: 'WOO' }); } ]
  ]
});

Once you've done this, you can then use it as a part of a stream within your requestListener function. See the barnacle-mode module on npm for an idea of how this would work. The idea is that you pipe in an object that contains req as a key and then it pipes onwards to a final stream that then pipes through to res.

0.5.0

10 years ago

0.4.0

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago