routes
stac_fastapi.api.routes ¶
Route factories.
Scope ¶
Bases: TypedDict
More strict version of Starlette's Scope.
Source code in stac_fastapi/api/stac_fastapi/api/routes.py
78 79 80 81 82 83 84 | |
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/stac_fastapi/api/routes.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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/stac_fastapi/api/routes.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
create_async_endpoint ¶
create_async_endpoint(
func: Callable, request_model: type[APIRequest] | type[BaseModel] | dict
) -> Callable[[Any, Any], Awaitable[Any]]
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/stac_fastapi/api/routes.py
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 | |
sync_to_async ¶
sync_to_async(func)
Run synchronous function asynchronously in a background thread.
Source code in stac_fastapi/api/stac_fastapi/api/routes.py
30 31 32 33 34 35 36 37 | |