routes
stac_fastapi.api.routes ¶
Route factories.
Scope ¶
Bases: TypedDict
More strict version of Starlette's Scope.
Source code in stac_fastapi/api/routes.py
81 82 83 84 85 86 87 |
|
add_direct_response ¶
add_direct_response(app: FastAPI) -> None
Setup FastAPI application's endpoints to return Response Object directly, avoiding Pydantic validation and FastAPI (slow) serialization.
ref: gist.github.com/Zaczero/00f3a2679ebc0a25eb938ed82bc63553
Source code in stac_fastapi/api/routes.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
add_route_dependencies ¶
add_route_dependencies(
routes: List[BaseRoute], scopes: List[Scope], dependencies: List[Depends]
) -> None
Add dependencies to routes.
Allows a developer to add dependencies to a route after the route has been defined.
"*" can be used for path or method to match all allowed routes.
Returns:
-
None
–None
Source code in stac_fastapi/api/routes.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
create_async_endpoint ¶
create_async_endpoint(
func: Callable, request_model: Union[Type[APIRequest], Type[BaseModel], Dict]
)
Wrap a function in a coroutine which may be used to create a FastAPI endpoint.
Synchronous functions are executed asynchronously using a background thread.
Source code in stac_fastapi/api/routes.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
sync_to_async ¶
sync_to_async(func)
Run synchronous function asynchronously in a background thread.
Source code in stac_fastapi/api/routes.py
29 30 31 32 33 34 35 36 |
|