Initial Rocket commit

This commit is contained in:
2024-07-14 18:33:58 +01:00
parent 12f77ce9af
commit 0fbd04e791
4 changed files with 1907 additions and 11 deletions

1872
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,5 +8,10 @@ edition = "2021"
[dependencies] [dependencies]
chrono = "0.4.38" chrono = "0.4.38"
lazy_static = "1.5.0" lazy_static = "1.5.0"
rocket = "0.5.1"
serde_json = "1.0.120" serde_json = "1.0.120"
ureq = { version = "2.10.0", features = ["json"] } ureq = { version = "2.10.0", features = ["json"] }
[dependencies.rocket_dyn_templates]
version = "0.2.0"
features = ["tera"]

14
src/main.rs Normal file
View File

@@ -0,0 +1,14 @@
#[macro_use] extern crate rocket;
use rocket_dyn_templates::{context, Template};
#[get("/")]
fn index() -> Template {
let context = context! {};
Template::render("index", context)
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])
.attach(Template::fairing())
}

27
templates/index.html.tera Normal file
View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Big Tim</title>
</head>
<body>
<h1>Welcome to Blockchain Time</h1><p>A.K.A. Big Tim</p>
<div>
<h2>Convert to Blockchain Time</h2>
<h3>Yay!</h3>
<form id="form" method="GET" action="to_blocktime">
<label for="input_datetime">Input DateTime (in UTC only currently)</label>
<input type="datetime-local" id="input_datetime" name="input_datetime">
</form>
</div>
<div>
<h2>Convert from Blockchain Time</h2>
<h3>Booo</h3>
...
</div>
<div class="cur_blocks">
...
</div>
{#__tera_context#}
</body>
</html>