feat: add route and tests
This commit is contained in:
parent
122c38a0da
commit
57704def31
5 changed files with 155 additions and 14 deletions
16
src/lib.rs
16
src/lib.rs
|
|
@ -2,18 +2,28 @@
|
|||
use axum::extract::{Path, Query};
|
||||
use axum::http::{Method, Uri};
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::routing::{get, get_service, IntoMakeService};
|
||||
use axum::routing::{get, get_service, post, IntoMakeService};
|
||||
use axum::Server;
|
||||
use axum::{middleware, Json, Router};
|
||||
use hyper::server::conn::AddrIncoming;
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
use std::net::SocketAddr;
|
||||
use std::net::TcpListener;
|
||||
|
||||
pub type App = Server<AddrIncoming, IntoMakeService<Router>>;
|
||||
|
||||
/// API routes
|
||||
#[derive(Deserialize)]
|
||||
struct FormData {
|
||||
email: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
/// API routing
|
||||
fn app() -> Router {
|
||||
Router::new().route("/health_check", get(|| async {}))
|
||||
Router::new()
|
||||
.route("/health_check", get(|| async {}))
|
||||
.route("/subscriptions", post(|| async {}))
|
||||
}
|
||||
|
||||
/// Start the server
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue