Exemple #1
0
    def include_extra_routes(self,
                             schema_url=None,
                             docs_url=None,
                             static_url=None):
        extra_routes = []

        from apistar.server.handlers import serve_documentation, serve_schema, serve_static_wsgi

        if schema_url:
            extra_routes += [
                Route(schema_url,
                      method='GET',
                      handler=serve_schema,
                      documented=False)
            ]
        if docs_url:
            extra_routes += [
                Route(docs_url,
                      method='GET',
                      handler=serve_documentation,
                      documented=False)
            ]
        if static_url:
            static_url = static_url.rstrip('/') + '/{+filename}'
            extra_routes += [
                Route(static_url,
                      method='GET',
                      handler=serve_static_wsgi,
                      name='static',
                      documented=False,
                      standalone=True)
            ]
        return extra_routes
Exemple #2
0
    def include_extra_routes(self,
                             schema_url=None,
                             docs_url=None,
                             static_url=None):
        extra_routes = []

        from apistar.server.handlers import (
            serve_documentation,
            serve_schema,
            serve_static_wsgi,
        )

        if schema_url:
            extra_routes += [
                Route(schema_url,
                      method="GET",
                      handler=serve_schema,
                      documented=False)
            ]
        if docs_url:
            extra_routes += [
                Route(
                    docs_url,
                    method="GET",
                    handler=serve_documentation,
                    documented=False,
                )
            ]
        if static_url:
            static_url = static_url.rstrip("/") + "/{+filename}"
            extra_routes += [
                Route(
                    static_url,
                    method="GET",
                    handler=serve_static_wsgi,
                    name="static",
                    documented=False,
                    standalone=True,
                )
            ]
        return extra_routes