zero2prod_axum/src/lib.rs
2023-12-23 14:10:35 +01:00

29 lines
769 B
Rust

#![allow(unused)]
use axum::extract::{Path, Query};
use axum::http::{Method, Uri};
use axum::response::{Html, IntoResponse, Response};
use axum::routing::{get, get_service, post, IntoMakeService};
use axum::serve::Serve;
use axum::{middleware, Json, Router};
use serde::Deserialize;
use serde_json::{json, Value};
use std::net::SocketAddr;
use tokio::net::TcpListener;
#[derive(Deserialize)]
struct FormData {
email: String,
name: String,
}
/// API routing
pub fn app() -> Router {
Router::new()
.route("/health_check", get(|| async {}))
.route("/subscriptions", post(|| async {}))
}
/// Start the server
pub fn run(listener: TcpListener) -> Serve<IntoMakeService<Router>, Router> {
axum::serve(listener, app().into_make_service())
}