text: // Generated by CoffeeScript 1.9.2
  (function() {
    'use strict';
    var bodyParser, config, express, method, methods, middleware, route, router, routes, url;
  
    bodyParser = require('body-parser');
  
    express = require('express');
  
    config = require('./config');
  
    middleware = require('./middleware');
  
    routes = require('./routes');
  
    router = express.Router(config.app.options);
  
    router.use(middleware.accessControl);
  
    router.use(bodyParser.json({
      limit: config.app.limits.json
    }));
  
    for (url in routes) {
      methods = routes[url];
      for (method in methods) {
        route = methods[method];
        if (route.hasOwnProperty('middleware')) {
          route.middleware.forEach(function(mw) {
            return router[method](url, mw);
          });
        }
        router[method](url, route.handler);
      }
    }
  
    if (typeof module !== "undefined" && module !== null) {
      module.exports = router;
    }
  
  }).call(this);
  