Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to define path for specific endpoint #457

Open
vincentsarago opened this issue Apr 14, 2022 · 1 comment
Open

Add method to define path for specific endpoint #457

vincentsarago opened this issue Apr 14, 2022 · 1 comment
Labels
breaking change enhancement New feature or request

Comments

@vincentsarago
Copy link
Member

Right now when using Factories we create endpoints with predefined paths

@self.router.get(r"/tiles/{z}/{x}/{y}", **img_endpoint_params)
@self.router.get(r"/tiles/{z}/{x}/{y}.{format}", **img_endpoint_params)
@self.router.get(r"/tiles/{z}/{x}/{y}@{scale}x", **img_endpoint_params)
@self.router.get(r"/tiles/{z}/{x}/{y}@{scale}x.{format}", **img_endpoint_params)
@self.router.get(r"/tiles/{TileMatrixSetId}/{z}/{x}/{y}", **img_endpoint_params)

Sometimes users would want a different schema (e.g no optional format in path or TileMatrixSet 🤷‍♂️)

The only example I know is stac-fastapi https://github.com/stac-utils/stac-fastapi/blob/06f610e74ca5eb1b28756ce66b508d5f974dd559/stac_fastapi/api/stac_fastapi/api/app.py#L172-L183

@vincentsarago vincentsarago added enhancement New feature or request breaking change labels Apr 14, 2022
@vincentsarago
Copy link
Member Author

note: in some ways I've been able to add path parameter to all endpoint within a Factory by adding prefix with {value}

https://github.com/stac-utils/titiler-pgstac/blob/b510490d0fc5764474493e206884773592a42f53/titiler/pgstac/main.py#L87-L95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant