       apply_helpers ctx
 
       f.call ctx, req, res, next
-
-  context.middleware = (f) ->
-    # If magic middleware is enabled the function will get wrapped
-    # by the caller; do not double-wrap it.
-    if app.settings['magic middleware']
-      f
-    else
-      wrap_middleware f
-
-  use_middleware = (f) ->
-    if app.settings['magic middleware']
-      wrap_middleware f
-    else
-      f
 
   context.use = ->
     zappa_middleware =

    app.disable i for i in arguments
    return

  wrap_middleware = (f) ->
    (req,res,next) ->
      ctx =
        app: app

      if zappa_middleware[name]
        app.use zappa_middleware[name](arg)
      else if typeof express[name] is 'function'
        app.use express[name](arg)
      else
        throw "Unknown middleware #{name}"

    for a in arguments
      switch typeof a
        when 'function' then app.use a
        when 'string' then use a
        when 'object'
          if a.stack? or a.route? or a.handle?
