Initial Rocket commit
This commit is contained in:
1872
Cargo.lock
generated
1872
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -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
14
src/main.rs
Normal 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
27
templates/index.html.tera
Normal 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>
|
||||||
Reference in New Issue
Block a user