Add route "GET /sign_up"
This commit is contained in:
parent
a7b13ea286
commit
d8c59850dc
|
@ -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,
|
||||
|
|
|
@ -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)~}}
|
Reference in New Issue