// use actix_web::{web, App, HttpResponse, HttpServer, Responder}; use serde::Deserialize; #[derive(Deserialize)] struct Register { username: String, country: String, } fn index() -> HttpResponse { HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body(include_str!("../static/form.html")) } fn register(form: web::Form) -> impl Responder { format!("Hello {} from {}!", form.username, form.country) } fn main() { HttpServer::new(|| { App::new() .route("/", web::get().to(index)) .route("/register", web::post().to(register)) }) .bind("127.0.0.1:8088") .unwrap() .run() .unwrap(); } //