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)
}
#[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![

@ -7,32 +7,31 @@
<link rel="stylesheet" href="/static/css/normalize.css"/>
</head>
<body>
<div class="title">
<h1>Monero Block Explorer</h1>
</div>
<div class="search">
<h2>Search</h2>
<form action="/" method="post">
<input type="text" name="search_value" placeholder="Enter a transaction hash, block hash, or block height.">
<input type="submit" value="Search">
</form>
</div>
<div class="server-info">
<h2>Server Info</h2>
</div>
<div class="network-stats">
<h2>Network Stats</h2>
</div>
<div class="tx-pool">
<h2>Transaction Pool</h2>
</div>
<div class="">
<h2>Top Block</h2>
</div>
<div class="">
<h2>Previous Block</h2>
</div>
<div class="title">
<h1>Monero Block Explorer</h1>
</div>
<div class="search">
<h2>Search</h2>
<form action="/" method="post">
<input type="text" name="search_value" placeholder="Enter a transaction hash, block hash, or block height.">
<input type="submit" value="Search">
</form>
</div>
<div class="server-info">
<h2>Server Info</h2>
</div>
<div class="network-stats">
<h2>Network Stats</h2>
</div>
<div class="tx-pool">
<h2>Transaction Pool</h2>
</div>
<div class="">
<h2>Top Block</h2>
</div>
<div class="">
<h2>Previous Block</h2>
</div>
<!--
<p>alt_blocks_count: {{ alt_blocks_count }}</p>
<p>block_size_limit: {{ block_size_limit }}</p>

Loading…
Cancel
Save