Final push before rewrite

This commit is contained in:
Jai A
2020-06-28 13:53:03 -07:00
parent d1efd62e7b
commit 1ff2a08d19
5 changed files with 34 additions and 28 deletions

View File

@@ -1,5 +1,13 @@
use actix_web::{get, web, HttpResponse};
use actix_web::{get, post, web, HttpResponse};
use handlebars::*;
use serde::Deserialize;
#[derive(Deserialize)]
struct CreatedMod {
name: String,
description: String,
body: String,
}
#[get("createmod")]
pub async fn mod_create_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
@@ -8,5 +16,15 @@ pub async fn mod_create_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
});
let body = hb.render("mod-create", &data).unwrap();
HttpResponse::Ok().body(body)
}
#[post("createmod")]
pub async fn mod_create_post(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
let data = json!({
"name": "Handlebars"
});
let body = hb.render("mod-create", &data).unwrap();
HttpResponse::Ok().body(body)
}