mirror of
https://github.com/LeNei/axum-sqlx-template.git
synced 2026-02-13 22:56:19 +00:00
Base login setup
This commit is contained in:
@@ -9,14 +9,11 @@ async fn ping() -> StatusCode {
|
||||
StatusCode::OK
|
||||
}
|
||||
|
||||
pub fn routes(api_context: ApiContext) -> Router {
|
||||
pub fn routes() -> Router<ApiContext> {
|
||||
let cors = CorsLayer::new()
|
||||
// allow `GET` and `POST` when accessing the resource
|
||||
.allow_methods([Method::GET, Method::POST])
|
||||
// allow requests from any origin
|
||||
.allow_origin(Any);
|
||||
Router::new()
|
||||
.route("/ping", get(ping))
|
||||
.layer(cors)
|
||||
.with_state(api_context)
|
||||
Router::new().route("/ping", get(ping)).layer(cors)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user