set up rocket server
|
@ -0,0 +1 @@
|
||||||
|
/target
|
|
@ -0,0 +1 @@
|
||||||
|
edition = "2021"
|
|
@ -0,0 +1,12 @@
|
||||||
|
[package]
|
||||||
|
name = "site"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rocket = { version = "0.5.0-rc.2", features = ["json"] }
|
||||||
|
reqwest = { version = "0.11", features = ["json"] }
|
||||||
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
|
|
@ -0,0 +1,46 @@
|
||||||
|
use rocket::fs::{relative, FileServer};
|
||||||
|
use rocket::{response::Responder, serde::json::Json};
|
||||||
|
use rocket_dyn_templates::{context, Template};
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate rocket;
|
||||||
|
|
||||||
|
#[get("/")]
|
||||||
|
async fn home() -> Template {
|
||||||
|
Template::render("home", context! { is_live: true, is_scrobbling: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/contact")]
|
||||||
|
async fn contact() -> Template {
|
||||||
|
Template::render("contact", context! {})
|
||||||
|
}
|
||||||
|
|
||||||
|
// #[get("/test")]
|
||||||
|
// async fn test() -> Result<Template, BlossomError> {
|
||||||
|
// let posts = reqwest::get("https://skinnyver.se/api/v1/accounts/cel/statuses").await;
|
||||||
|
// posts
|
||||||
|
// }
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), rocket::Error> {
|
||||||
|
let _rocket = rocket::build()
|
||||||
|
.attach(Template::fairing())
|
||||||
|
.mount("/", routes![home, contact])
|
||||||
|
.mount("/", FileServer::from(relative!("static")))
|
||||||
|
.launch()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Responder)]
|
||||||
|
enum BlossomError {
|
||||||
|
#[response(status = 500)]
|
||||||
|
Reqwest(&'static str, #[response(ignore)] reqwest::Error),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<reqwest::Error> for BlossomError {
|
||||||
|
fn from(e: reqwest::Error) -> Self {
|
||||||
|
BlossomError::Reqwest("reqwest error", e)
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 2.1 MiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 2.1 MiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.1 MiB |
|
@ -0,0 +1,12 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: kaerukaeru;
|
||||||
|
src: url('/fonts/kaerukaeru-Regular.woff2') format('woff2'),
|
||||||
|
url('/fonts/kaerukaeru-Regular.woff') format('woff');
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: Louise;
|
||||||
|
src: url('/fonts/Louise-Regular.woff2') format('woff2'),
|
||||||
|
url('/fonts/Louise-Regular.woff') format('woff');
|
||||||
|
}
|
||||||
|
|
After Width: | Height: | Size: 938 KiB |