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

path = require 'path'

class Exprestive
  constructor: (baseDir, @options = {}) ->
    @appDir             = path.resolve baseDir, @options.appDir ? ''
    @routesFilePath     = path.resolve @appDir, @options.routesFilePath ? 'routes'
    @controllersDirPath = path.resolve @appDir, @options.controllersDirPath ? 'controllers'
    @middlewareRouter = express.Router()


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


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

      @controllers[controllerName] = new Controller


  # Sets the @routesMethod from the function exported from @routesFilePath
  initializeRoutes: ->
    return if @routesInitialized
    @routesInitialized = yes
