1
0
Fork 0

Add route "GET /sign_up"

This commit is contained in:
Alex Kotov 2020-10-15 22:47:48 +05:00
parent a7b13ea286
commit d8c59850dc
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 23 additions and 1 deletions

View File

@ -14,7 +14,7 @@ struct TemplateContext {
}
pub fn routes() -> Vec<rocket::Route> {
routes![index, sign_up]
routes![index, sign_up_show, sign_up]
}
#[get("/")]
@ -29,6 +29,16 @@ fn index(db_conn: database::DbConn) -> Template {
Template::render("index", &template_context)
}
#[get("/sign_up")]
fn sign_up_show(db_conn: database::DbConn) -> Template {
let template_context = TemplateContext {
parent: "layout",
users: None,
};
Template::render("sign_up", &template_context)
}
#[post("/users", data = "<user_sign_up_form>")]
fn sign_up(
db_conn: database::DbConn,

View File

@ -0,0 +1,12 @@
{{#*inline "page"}}
<h1>Sign Up</h1>
<form action="/sign_up">
<input type="text"/>
<input type="password"/>
<button type="submit">Sign Up</button>
</form>
{{/inline}}
{{~> (parent)~}}