refactor: Migrate the backend to a REST api
Describe the issue
The current backend is a bit messy and serves the ingest response with a fully generated HTML response. This is an issue for agent compatibility and this can slow us a lot for future features.
We need a REST api ready for a future proof frontend.
Only 1 endpoint needed : GET /api/ingest
This can then be used as a reference for future endpoints as for #318 .
I'm currently working on a refactor of the backend and make the frontend works with the changes.
After talking about it with @cyclotruc , we need a REST api and start thinking about the future.
So, here's the changes i'm thinking about :
Breaking changes
GET & POST /apineeds to be the entry point of our backend API, it's currently deprecated and doesn't serves any purpose so it's going to be removedGET /the "index" endpoint needs to render only the needed HTMLGET /{full_path:path}will follow the same pattern thanGET /endpoint (our index, app entrypoint)POST /will be removedPOST /{full_path:path}will be removedGET /download/{ingest_id}will be removed, the download feature will be implemented on the frontend side
New endpoints
POST /api/ingestis going to be our main endpoint, bothGET /{full_path:path}andGET /are going to use it to request ingest, the response will be a JSON formated object.
Generated openapi and Swagger UI
- All useless endpoints will be removed from the openapi generated file. Only
/api/ingestand API related endpoints will be described. - The
GET /docsendpoint, automatically generated by FastAPI, will have a new look, integrating the swagger ui to the style of gitingest.
It's a lot of work, and I intend to make it happen, but the frontend is going to be cumbersome. My goal is to get the backend ready for an entirely new front-end approach, the templating style has its limits and it's going to give us a lot of problems in the future.
The WIP is available on #346 I'm not familiar with the github workflow, so I'm a bit surprised that the PR was created even without any action on my part.
@ix-56h No worries! Thanks for the PR, let's continue discussing over there