def create_version_app(global_conf, **local_conf): """Creates Version application""" ctrl = versions.Versions() controllers = { '/': ctrl, # redirect http://host:port/ down to Version app # avoid conflicts with actual pipelines and 404 error '/version': ctrl, # list all the versions '/version/{version_id}': ctrl # display details of the version } wsgi_app = falcon.API() for route, ctrl in controllers.items(): wsgi_app.add_route(route, ctrl) return wsgi_app
def before(self): self.versions = versions.Versions() self.api.add_route("/version/", self.versions) self.api.add_route("/version/{version_id}", self.versions)