     @middlewareRouter
 
 
+  # Populates @controllers by instantiating controllers found in @controllerDirPath
   initializeControllers: ->
     @controllers = @options.controllers ? {}
     return if @options.controllers?

      @controllers[controllerName] = new Controller


  initializeRoutes: ->
    return if @routesInitialized
    @routesInitialized = yes

path = require 'path'

class Exprestive

  constructor: (baseDir, @options = {}) ->

    # The directory where routes and controllers can be found
    # Used only as a relative directory for @routesFilePath and @controllersDirPath
    @appDir = path.resolve baseDir, @options.appDir ? ''

    # Path to the routes file
    @routesFilePath = path.resolve @appDir, @options.routesFilePath ? 'routes'

    # Path to the directory to look for controllers
    @controllersDirPath = path.resolve @appDir, @options.controllersDirPath ? 'controllers'

    # Router to register routes and pass to express as middleware
    @middlewareRouter = express.Router()


  # Registers a route on @middlewareRouter
  addRoute: ({ httpMethod, url, controllerName, controllerAction }) ->
    @middlewareRouter[httpMethod.toLowerCase()] url, =>
      @controllers[camelCase controllerName][controllerAction] arguments...


  # Returns the hash of methods passed to the routes file function
  getRoutesHelperMethods: ->
    helperMethods = {}
    for httpMethod in ['GET', 'POST', 'PUT', 'DELETE']
