 #### Routes
-# We are setting up theese routes:
-#
-# GET, POST, PUT, DELETE methods are going to the same controller methods - we dont care.
-# We are using method names to determine controller actions for clearness.
 
 module.exports = (app) ->
   

    actionMethod = controller[methodName].bind controller
    actionMethod req, res, next
  else
    console.warn 'method not found: ' + methodName
    next()

    res.statusCode = 404
    res.render '404', 404

# Render the page based on controller name, method and id
routeMVC = (controllerName, methodName, req, res, next) ->
  controllerName = 'index' if not controllerName?
  controller = null
  try
    controller = require './controllers/' + controllerName
  catch e
#    console.warn "controller not found: " + controllerName, e
    next()
