python-discord / api

A FastAPI-based service that allows our services to communicatie with our database.
MIT License
10 stars 1 forks source link

Fallback to the old API for undefined routes. #14

Closed jchristgit closed 2 years ago

jchristgit commented 3 years ago

This adds a new endpoint handler using the path converter in order to match requests directed to any subtree. As long as this endpoint is the last to be included in the router, all requests not matching defined routes under the /api endpoint will be forwarded to the old API.

Two new settings are added for this. One is the endpoint of the old API to forward to, which may change in the future due to the pending subdomain removal pull request. The other is the API token to use for the new API authenticating with the old API: Whilst everything else sent by the client is forwarded to the old API, the authorization schemes between the new and old API differ.

The entire point behind this functionality is to allow us to incrementally port over endpoints to the new API, whilst reconfiguring clients to use the new API completely.

Closes #8.

Shivansh-007 commented 3 years ago

Could we possibly add the python-discord/site GHCR package to docker-compose.yml?

jchristgit commented 3 years ago

Could we possibly add the python-discord/site GHCR package to docker-compose.yml?

I also thought about that, but decided against it, due to the docker initialization steps required to get the site up and running. I don't really want to duplicate postgres/init.sql across the repositories (albeit not sure if it's required in the first place), and if you have the site development set up locally, it's very straightforward to use it.

jchristgit commented 2 years ago

Closing this per us sunsetting this project.