stac-utils / stac-fastapi

STAC API implementation with FastAPI.
https://stac-utils.github.io/stac-fastapi/
MIT License
229 stars 99 forks source link

Move link creation to fastapi dependency #402

Open geospatial-jeff opened 2 years ago

geospatial-jeff commented 2 years ago

Right now there is a starlette request object that is injected into each endpoint and the user is responsible for creating links. The starlette request object is available from within a fastapi dependency, so it may be easier to create links inside a dependency and inject these links into each endpoint.

geospatial-jeff commented 1 year ago

This is a good way to encapsulate all of the logic required to generate base URL for links including forwarding headers, router prefixes etc.