Closed Hirevo closed 1 year ago
The migration to Axum is now complete, and the authorization handling has now been improved through the use of custom Auth
extractors (one for the frontend based on server-side sessions, and one for the API based on Cargo tokens in Authorization
headers).
After the merging of this PR, all other PRs will have to be significantly updated.
I'll try to do this for the ones that I was working on before starting this migration.
This PR migrates all of Alexandrie's codebase to use:
axum
instead oftide
as its web frameworktokio
instead ofasync-std
as its main async runtimetracing
instead ofslog
as the logging mechanismtower
as the mean to implement middlewares (called layers)which also implies that we now use:
http
instead ofhttp-types
as its HTTP type definitionshyper
instead ofasync-h1
as its HTTP parser implementationThis move allows to remove some async runtime duplication that was existing in Alexandrie due to its use of libraries that always assumed to be running a
tokio
runtime (likerusoto
for interactions with S3).Although I still find
tide
to be a very nice web framework, its reliance onasync-std
makes it a bit annoying to work with and can prevent integrations with other library integrations (like middlewares or frontend frameworks likeleptos
which I am considering using as a replacement forhandlebars
templating and flash session data especially for pages with rich interactions like the account management page).The primary goal of this PR is to keep everything working just like before, and therefore is pretty much a 1-to-1 translation from the old to the new framework.
This means that there may be things that may be significantly improved by using more advanced features of the
axum
framework, like handling the authentication using theAuthorization
header in the API, which is implemented a bit naively here.These improvements will come in subsequent PRs.
Closes #159.