From aaf6325c23a0c47d3b24a3e41355a907a27c8b37 Mon Sep 17 00:00:00 2001 From: lalanza808 Date: Mon, 30 Mar 2020 00:16:20 -0700 Subject: [PATCH] adding new post method and starting a search --- src/main.rs | 10 ++++-- templates/index.html.tera | 65 +++++++++++++++++++------------------- templates/search.html.tera | 1 + 3 files changed, 41 insertions(+), 35 deletions(-) create mode 100644 templates/search.html.tera diff --git a/src/main.rs b/src/main.rs index 4585850..696ddc8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,11 +65,17 @@ fn get_daemon_info() -> Json { Json(res.result) } +#[post("/", format = "application/x-www-form-urlencoded")] +fn something() -> Template { + let res: GetInfo = issue_rpc(&"get_info", None) + .send().unwrap().json().unwrap(); + Template::render("search", &res.result) +} + #[get("/")] fn index() -> Template { let res: GetInfo = issue_rpc(&"get_info", None) .send().unwrap().json().unwrap(); - // let res_json = serde_json::to_string(&res.result).unwrap(); Template::render("index", &res.result) } @@ -87,7 +93,7 @@ fn main() { Ok(_) => { rocket::ignite() .mount("/", routes![ - index, + index, something, get_daemon_info ]) .mount("/block", routes![ diff --git a/templates/index.html.tera b/templates/index.html.tera index 4105606..9e051e2 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -1,38 +1,37 @@ - - - Monero Block Explorer - - - - - -
-

Monero Block Explorer

-
- -
-

Server Info

-
-
-

Network Stats

-
-
-

Transaction Pool

-
-
-

Top Block

-
-
-

Previous Block

-
+ + + Monero Block Explorer + + + + +
+

Monero Block Explorer

+
+ +
+

Server Info

+
+
+

Network Stats

+
+
+

Transaction Pool

+
+
+

Top Block

+
+
+

Previous Block

+