-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
d08f70e refactor(api): [#174] Axum API scaffolding (Jose Celano) 7bcf20e feat: disable sqlx logging for all statements (Jose Celano) 7347fee feat(api): [#174] new cargo dependencies: axum, hyper (Jose Celano) Pull request description: Basic changes which are needed to run the Axum API implementation in parallel with the current one with ActixWeb. For the time being the Axum implementation will be only used for testing until all endpoints are migrated. Top commit has no ACKs. Tree-SHA512: 6d0b8ed20329e91ba92bf5d78caf366b1fb61c2048040154b68da876878cd73f5de372be0955c492b82f307cbe8786d702ce86dbfa201900d6d98ea1913ba85b
- Loading branch information
Showing
25 changed files
with
523 additions
and
101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
use torrust_index_backend::app; | ||
use torrust_index_backend::bootstrap::config::init_configuration; | ||
use torrust_index_backend::web::api::Implementation; | ||
|
||
#[actix_web::main] | ||
#[tokio::main] | ||
async fn main() -> Result<(), std::io::Error> { | ||
let configuration = init_configuration().await; | ||
|
||
let app = app::run(configuration).await; | ||
// todo: we are migrating from actix-web to axum, so we need to keep both | ||
// implementations for a while. For production we only use ActixWeb. | ||
// Once the Axum implementation is finished and stable, we can switch to it | ||
// and remove the ActixWeb implementation. | ||
let api_implementation = Implementation::ActixWeb; | ||
|
||
app.api_server.await | ||
let app = app::run(configuration, &api_implementation).await; | ||
|
||
match api_implementation { | ||
Implementation::ActixWeb => app.actix_web_api_server.unwrap().await.expect("the API server was dropped"), | ||
Implementation::Axum => app.axum_api_server.unwrap().await.expect("the Axum API server was dropped"), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.