-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Axum framework (#32)
* add clerk authorizer * refactor actix validator to use clerk authorizer * add axum validator * add axum example * bump version
- Loading branch information
1 parent
f0f73c4
commit 11d1b3c
Showing
10 changed files
with
678 additions
and
184 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use axum::{routing::get, Router}; | ||
use clerk_rs::validators::axum::ClerkLayer; | ||
use clerk_rs::ClerkConfiguration; | ||
use std::net::SocketAddr; | ||
|
||
async fn index() -> &'static str { | ||
"Hello world!" | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> std::io::Result<()> { | ||
let config: ClerkConfiguration = ClerkConfiguration::new(None, None, Some("your_secret_key".to_string()), None); | ||
let app = Router::new().route("/index", get(index)).layer(ClerkLayer::new(config, None, true)); | ||
let addr = SocketAddr::from(([0, 0, 0, 0], 8080)); | ||
let listener = tokio::net::TcpListener::bind(addr).await?; | ||
axum::serve(listener, app).await | ||
} |
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.