adding new post method and starting a search

master
lalanza808 5 years ago
parent 3186695906
commit aaf6325c23

@ -65,11 +65,17 @@ fn get_daemon_info() -> Json<GetInfoResult> {
Json(res.result) 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("/")] #[get("/")]
fn index() -> Template { fn index() -> Template {
let res: GetInfo = issue_rpc(&"get_info", None) let res: GetInfo = issue_rpc(&"get_info", None)
.send().unwrap().json().unwrap(); .send().unwrap().json().unwrap();
// let res_json = serde_json::to_string(&res.result).unwrap();
Template::render("index", &res.result) Template::render("index", &res.result)
} }
@ -87,7 +93,7 @@ fn main() {
Ok(_) => { Ok(_) => {
rocket::ignite() rocket::ignite()
.mount("/", routes![ .mount("/", routes![
index, index, something,
get_daemon_info get_daemon_info
]) ])
.mount("/block", routes![ .mount("/block", routes![

@ -7,7 +7,6 @@
<link rel="stylesheet" href="/static/css/normalize.css"/> <link rel="stylesheet" href="/static/css/normalize.css"/>
</head> </head>
<body> <body>
<div class="title"> <div class="title">
<h1>Monero Block Explorer</h1> <h1>Monero Block Explorer</h1>
</div> </div>

Loading…
Cancel
Save