add index route
This commit is contained in:
parent
d4ea5b55b9
commit
37137c3e84
|
@ -1,9 +1,10 @@
|
||||||
use axum::{extract::DefaultBodyLimit, routing::get, routing::post, Router};
|
use axum::{extract::DefaultBodyLimit, routing::get, routing::post, Router};
|
||||||
|
|
||||||
use crate::routes::{health::health_route, liquid::liquid_rescale_route};
|
use crate::routes::{health::health_route, index::index_route, liquid::liquid_rescale_route};
|
||||||
|
|
||||||
pub fn create_router() -> Router {
|
pub fn create_router() -> Router {
|
||||||
Router::new()
|
Router::new()
|
||||||
|
.route("/", get(index_route))
|
||||||
.route("/health", get(health_route))
|
.route("/health", get(health_route))
|
||||||
.route("/liquid", post(liquid_rescale_route))
|
.route("/liquid", post(liquid_rescale_route))
|
||||||
.layer(DefaultBodyLimit::max(1024 * 10_000 /* 10 MiB */))
|
.layer(DefaultBodyLimit::max(1024 * 10_000 /* 10 MiB */))
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
use axum::{response::IntoResponse, Json};
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
|
pub async fn index_route() -> impl IntoResponse {
|
||||||
|
let data = json!({
|
||||||
|
"name": "liquid-rescale-api",
|
||||||
|
"version": env!("CARGO_PKG_VERSION"),
|
||||||
|
"about": "Welcome traveler!"
|
||||||
|
});
|
||||||
|
|
||||||
|
Json(data)
|
||||||
|
}
|
|
@ -1,2 +1,3 @@
|
||||||
pub mod health;
|
pub mod health;
|
||||||
|
pub mod index;
|
||||||
pub mod liquid;
|
pub mod liquid;
|
||||||
|
|
Loading…
Reference in New Issue