parent
910712f859
commit
1e9bf9abff
@ -0,0 +1,5 @@
|
||||
mod submit_get;
|
||||
mod submit_post;
|
||||
|
||||
pub use submit_get::get;
|
||||
pub use submit_post::post;
|
@ -0,0 +1,13 @@
|
||||
use actix_web::{get, web, HttpResponse};
|
||||
use handlebars::Handlebars;
|
||||
use serde_json::json;
|
||||
|
||||
#[get("/submit")]
|
||||
pub async fn get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
|
||||
let data = json!({
|
||||
"name": "rewot"
|
||||
});
|
||||
let body = hb.render("submit", &data).unwrap();
|
||||
|
||||
HttpResponse::Ok().body(body)
|
||||
}
|
@ -1,20 +1,10 @@
|
||||
use actix_web::{get, post, web, HttpResponse};
|
||||
use actix_web::{post, web, HttpResponse};
|
||||
use handlebars::Handlebars;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::FormData;
|
||||
use crate::WotLog;
|
||||
|
||||
#[get("/submit")]
|
||||
pub async fn get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
|
||||
let data = json!({
|
||||
"name": "rewot"
|
||||
});
|
||||
let body = hb.render("submit", &data).unwrap();
|
||||
|
||||
HttpResponse::Ok().body(body)
|
||||
}
|
||||
|
||||
#[post("/submit")]
|
||||
pub async fn post(form: web::Form<FormData>, hb: web::Data<Handlebars<'_>>) -> HttpResponse {
|
||||
let form_data = form.into_inner();
|
Loading…
Reference in new issue