-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
AppService
trait and use it to implement the HTTP service
Add an `AppService` trait to allow consumers to define custom services that will be run as tokio tasks. This is similar (I believe) to Laraval's `Provider` concept. Use the `AppService` trait to add an HTTP server using Axum instead of putting http/axum specific methods directly on the `App` trait
- Loading branch information
1 parent
92f0101
commit 299e72d
Showing
11 changed files
with
362 additions
and
224 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,4 @@ | ||
use async_trait::async_trait; | ||
use clap::Parser; | ||
use tracing::info; | ||
|
||
use crate::app::App; | ||
use crate::app_context::AppContext; | ||
use crate::cli::{RoadsterCli, RunRoadsterCommand}; | ||
|
||
#[derive(Debug, Parser)] | ||
pub struct ListRoutesArgs {} | ||
|
||
#[async_trait] | ||
impl<A> RunRoadsterCommand<A> for ListRoutesArgs | ||
where | ||
A: App, | ||
{ | ||
async fn run( | ||
&self, | ||
_app: &A, | ||
_cli: &RoadsterCli, | ||
context: &AppContext, | ||
) -> anyhow::Result<bool> { | ||
info!("API routes:"); | ||
context | ||
.api | ||
.as_ref() | ||
.operations() | ||
.for_each(|(path, method, _operation)| info!("[{method}]\t{path}")); | ||
Ok(true) | ||
} | ||
} |
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.