code: def add_route(route, endpoint=None, **kw):
      
      def wrapper(f):
          try:
              router.DefaultRouter.add_url_rule(route,
                                                endpoint=endpoint,
                                                view_func=f,
                                                options=kw)
          except AssertionError, e:
              logger.warn("Failed to register route {}: {}".format(route, e))
          return f
      return wrapper
docs: Add a new JSON API route