+
+# TODO: Support custom "404 Not Found" page.
 
 compression = require "compression"
 assertTypes = require "assertTypes"

    # Start with the first pipe.
    Promise.try next

    # Unhandled requests end up here.
    .then ->
      return if res._headerSent
      res.status 404
      res.send {error: "This page does not exist. Sorry!"}
      # TODO: Support custom "404 Not Found" page.

    # Uncaught errors end up here.
    .fail (error) ->
      console.log error.stack

    # Continue to the next pipe.
    startTime = null
    next = ->

      if ++index is length
        res.status 404
        res.send {error: "Nothing exists here. Sorry!"}
        return

      startTime = now()
      result = pipes[index].call context, req, res
      if result and typeof result.then is "function"
