     setupWebapp = (webappName) ->
         webappPath = path.resolve webappsPath, webappName
         middlewaresPath = path.resolve webappPath, 'middlewares'
-
+        preMiddlewaresPath = path.join middlewaresPath, 'pre'
+        postMiddlewaresPath = path.join middlewaresPath, 'post'
 
         debug "Requiring '#{webappName}' at '#{webappPath}'"
         webapp = require webappPath

fs = require "fs"
path = require "path"

exports = module.exports = load = (webappsPath, callback)->
    debug "Loading webapps from '%s'", webappsPath
    webapps = []
    isDir = (content) ->
        webappPath = path.resolve webappsPath, content
        stats = fs.statSync webappPath

        controllerNames = Object.keys controllers
        debug "Loaded '#{controllerNames.length}' controller(s) from webapp '#{webappName}': #{controllerNames.join ", "}"

        preMiddlewares = loadFiles preMiddlewaresPath
        preMiddlewareNames = Object.keys preMiddlewares
        debug "Loaded '#{preMiddlewareNames.length}' pre middleware(s) from webapp '#{webappName}': #{preMiddlewareNames.join ", "}"

        postMiddlewares = loadFiles postMiddlewaresPath
        postMiddlewareNames = Object.keys postMiddlewares
        debug "Loaded '#{postMiddlewareNames.length}' pre middleware(s) from webapp '#{webappName}': #{postMiddlewareNames.join ", "}"

        mountpoint = "/#{webappName}/"
        # TODO: This should be configurable via package.json or somehow. How?
        if webappName == "MAIN" then mountpoint = "/"
        webappSettings =
            mountpoint : mountpoint
            preMiddlewares : preMiddlewares or []
            postMiddlewares : postMiddlewares or []
            mountpoint : mountpoint
            app : webapp
            controllers : controllers
            routers : routers or []
            name : webappName
            path : webappPath

