   fs.readFileSync p, 'utf8'
 
 # Takes in a function and builds express/socket.io apps based on the rules contained in it.
-zappa.app = (func) ->
+zappa.app = (func, extserv) ->
   context = {id: uuid(), zappa, express}
   
   context.root = path.dirname(module.parent.filename)

        else port = (Number) a
      when 'number' then port = a
      when 'function' then root_function = a

  zapp = zappa.app(root_function)
  app = zapp.app

  ws_handlers = {}
  helpers = {}
  postrenders = {}
  if extserv
    app = context.app = extserv
  else
    app = context.app = express.createServer()
  io = context.io = socketio.listen(app)

  # Tracks if the zappa middleware is already mounted (`@use 'zappa'`).
