1
0
mirror of https://github.com/actix/actix-website synced 2025-02-02 12:19:04 +01:00

24 lines
495 B
Rust
Raw Normal View History

2019-06-17 14:34:23 -04:00
// <urlencoded>
2019-06-26 01:27:17 -04:00
use actix_web::{web, HttpResponse};
use serde::Deserialize;
2019-06-17 14:34:23 -04:00
2019-06-26 01:27:17 -04:00
#[derive(Deserialize)]
struct FormData {
username: String,
}
2019-06-17 14:34:23 -04:00
2019-06-26 01:27:17 -04:00
fn index(form: web::Form<FormData>) -> HttpResponse {
HttpResponse::Ok().body(format!("username: {}", form.username))
}
2019-06-17 14:34:23 -04:00
// </urlencoded>
2019-06-26 01:27:17 -04: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();
}