2019-06-17 20:34:23 +02:00
|
|
|
// <urlencoded>
|
2019-06-26 07:27:17 +02:00
|
|
|
use actix_web::{web, HttpResponse};
|
|
|
|
use serde::Deserialize;
|
2019-06-17 20:34:23 +02:00
|
|
|
|
2019-06-26 07:27:17 +02:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
struct FormData {
|
|
|
|
username: String,
|
|
|
|
}
|
2019-06-17 20:34:23 +02:00
|
|
|
|
2019-06-26 07:27:17 +02:00
|
|
|
fn index(form: web::Form<FormData>) -> HttpResponse {
|
|
|
|
HttpResponse::Ok().body(format!("username: {}", form.username))
|
|
|
|
}
|
2019-06-17 20:34:23 +02:00
|
|
|
// </urlencoded>
|
2019-06-26 07:27:17 +02:00
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
use actix_web::{App, HttpServer};
|
|
|
|
|
|
|
|
HttpServer::new(|| App::new().route("/", web::post().to(index)))
|
|
|
|
.bind("127.0.0.1:8088")
|
|
|
|
.unwrap()
|
|
|
|
.run()
|
|
|
|
.unwrap();
|
|
|
|
}
|