Added updating blockchains button
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -1,6 +1,6 @@
|
||||
#[macro_use] extern crate rocket;
|
||||
use rocket_dyn_templates::{context, Template};
|
||||
use blockchain_time::{BlockchainInfo, BlockchainSupported};
|
||||
use blockchain_time::{BlockchainInfo, BlockchainSupported, update_all_blockheights};
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Template {
|
||||
@@ -16,8 +16,15 @@ fn index() -> Template {
|
||||
Template::render("index", context)
|
||||
}
|
||||
|
||||
#[get("/update_blockchains")]
|
||||
fn update_blockchains() -> Template {
|
||||
update_all_blockheights();
|
||||
Template::render("update_complete", context!{})
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build().mount("/", routes![index])
|
||||
rocket::build().mount("/", routes![index, update_blockchains])
|
||||
// .mount("/update_blockchains", routes![update_blockchains])
|
||||
.attach(Template::fairing())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user