def route(self, method, route, handler, nodoc=False, resource=None):
        self._ensureInit()
        # Insertion sort to maintain routes in required order.
        nLengthRoutes = self._routes[method.lower()][len(route)]
        for i in range(len(nLengthRoutes)):
            if self._shouldInsertRoute(route, nLengthRoutes[i][0]):
                nLengthRoutes.insert(i, (route, handler))
                break
        else:
            nLengthRoutes.append((route, handler))

        # Now handle the api doc if the handler has any attached
        if resource is None and hasattr(self, 'resourceName'):
            resource = self.resourceName
        elif resource is None:
            resource = handler.__module__.rsplit('.', 1)[-1]

        if hasattr(handler, 'description'):
            if handler.description is not None:
                docs.addRouteDocs(
                    resource=resource, route=route, method=method,
                    info=handler.description.asDict(), handler=handler)
        elif not nodoc:
            routePath = '/'.join([resource] + list(route))
            print(TerminalColor.warning(
                'WARNING: No description docs present for route %s %s' % (
                    method, routePath)))

        # Warn if there is no access decorator on the handler function
        if not hasattr(handler, 'accessLevel'):
            routePath = '/'.join([resource] + list(route))
            print(TerminalColor.warning(
                'WARNING: No access level specified for route %s %s' % (
                    method, routePath)))

        if method.lower() not in ('head', 'get') \
            and hasattr(handler, 'cookieAuth') \
            and not (isinstance(handler.cookieAuth, tuple) and
                     handler.cookieAuth[1]):
            routePath = '/'.join([resource] + list(route))
            print(TerminalColor.warning(
                  'WARNING: Cannot allow cookie authentication for '
                  'route %s %s without specifying "force=True"' % (
                      method, routePath)))
Define a route for your REST resource.
dataset/ETHPy150Open girder/girder/girder/api/rest.py/Resource.route