serve index page
This commit is contained in:
parent
cb42d99c43
commit
db7998bbed
|
@ -2187,6 +2187,7 @@ dependencies = [
|
||||||
"comrak",
|
"comrak",
|
||||||
"envy",
|
"envy",
|
||||||
"log 0.4.8",
|
"log 0.4.8",
|
||||||
|
"mime 0.3.16",
|
||||||
"pretty_env_logger",
|
"pretty_env_logger",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"ructe",
|
"ructe",
|
||||||
|
|
|
@ -13,6 +13,7 @@ comrak = "0.7"
|
||||||
envy = "0.4"
|
envy = "0.4"
|
||||||
log = "0"
|
log = "0"
|
||||||
pretty_env_logger = "0"
|
pretty_env_logger = "0"
|
||||||
|
mime = "0.3.0"
|
||||||
rand = "0"
|
rand = "0"
|
||||||
ructe = "0.11"
|
ructe = "0.11"
|
||||||
serde_dhall = "0.5.3"
|
serde_dhall = "0.5.3"
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
use crate::templates::{self, RenderRucte};
|
||||||
|
use warp::{
|
||||||
|
http::{Response, StatusCode},
|
||||||
|
path, Filter, Rejection, Reply,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub async fn index() -> Result<impl Reply, Rejection> {
|
||||||
|
Response::builder().html(|o| templates::index_html(o))
|
||||||
|
}
|
20
src/main.rs
20
src/main.rs
|
@ -1,7 +1,8 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use warp::Filter;
|
use warp::{path, Filter};
|
||||||
|
|
||||||
pub mod app;
|
pub mod app;
|
||||||
|
pub mod handlers;
|
||||||
pub mod signalboost;
|
pub mod signalboost;
|
||||||
|
|
||||||
const APPLICATION_NAME: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
const APPLICATION_NAME: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||||
|
@ -15,9 +16,20 @@ async fn main() -> Result<()> {
|
||||||
// GET /hello/warp => 200 OK with body "Hello, warp!"
|
// GET /hello/warp => 200 OK with body "Hello, warp!"
|
||||||
let hello = warp::path!("hello" / String).map(|name| format!("Hello, {}!", name));
|
let hello = warp::path!("hello" / String).map(|name| format!("Hello, {}!", name));
|
||||||
|
|
||||||
warp::serve(hello.with(warp::log(APPLICATION_NAME)))
|
let files = warp::path("static")
|
||||||
.run(([127, 0, 0, 1], 3030))
|
.and(warp::fs::dir("./static"))
|
||||||
.await;
|
.or(warp::path("css").and(warp::fs::dir("./css")));
|
||||||
|
|
||||||
|
let site = warp::get()
|
||||||
|
.and(path::end())
|
||||||
|
.and_then(handlers::index)
|
||||||
|
.or(hello)
|
||||||
|
.or(files)
|
||||||
|
.with(warp::log(APPLICATION_NAME));
|
||||||
|
|
||||||
|
warp::serve(site).run(([127, 0, 0, 1], 3030)).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@()
|
@()
|
||||||
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<blockquote>Copyright 2020 Christine Dodrill. Any and all opinions listed here are my own and not representative of my employers; future, past and present.</blockquote>
|
<blockquote>Copyright 2020 Christine Dodrill. Any and all opinions listed here are my own and not representative of my employers; future, past and present.</blockquote>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
|
@use super::{header_html, footer_html};
|
||||||
|
|
||||||
@()
|
@()
|
||||||
|
|
||||||
|
@:header_html(None, None)
|
||||||
|
|
||||||
<link rel="authorization_endpoint" href="https://idp.christine.website/auth">
|
<link rel="authorization_endpoint" href="https://idp.christine.website/auth">
|
||||||
<link rel="canonical" href="https://christine.website/">
|
<link rel="canonical" href="https://christine.website/">
|
||||||
<meta name="google-site-verification" content="rzs9eBEquMYr9Phrg0Xm0mIwFjDBcbdgJ3jF6Disy-k" />
|
<meta name="google-site-verification" content="rzs9eBEquMYr9Phrg0Xm0mIwFjDBcbdgJ3jF6Disy-k" />
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
@{
|
@{
|
||||||
"@context": "http://schema.org/",
|
"@@context": "http://schema.org/",
|
||||||
"@type": "Person",
|
"@@type": "Person",
|
||||||
"name": "Christine Dodrill",
|
"name": "Christine Dodrill",
|
||||||
"alternateName": "Cadey, Xe, Xena",
|
"alternateName": "Cadey, Xe, Xena",
|
||||||
"url": "https://christine.website",
|
"url": "https://christine.website",
|
||||||
|
@ -15,7 +19,7 @@
|
||||||
"https://github.com/Xe",
|
"https://github.com/Xe",
|
||||||
"https://git.xeserv.us/xena",
|
"https://git.xeserv.us/xena",
|
||||||
"https://twitter.com/theprincessxena",
|
"https://twitter.com/theprincessxena",
|
||||||
"https://mst3k.interlinked.me/@cadey",
|
"https://mst3k.interlinked.me/@@cadey",
|
||||||
"https://www.linkedin.com/in/christine-dodrill-1827a010b/",
|
"https://www.linkedin.com/in/christine-dodrill-1827a010b/",
|
||||||
"https://www.youtube.com/user/shadowh511"
|
"https://www.youtube.com/user/shadowh511"
|
||||||
]
|
]
|
||||||
|
@ -24,7 +28,7 @@
|
||||||
|
|
||||||
<!-- Twitter -->
|
<!-- Twitter -->
|
||||||
<meta name="twitter:card" content="summary" />
|
<meta name="twitter:card" content="summary" />
|
||||||
<meta name="twitter:site" content="@theprincessxena" />
|
<meta name="twitter:site" content="@@theprincessxena" />
|
||||||
<meta name="twitter:title" content="Christine Dodrill" />
|
<meta name="twitter:title" content="Christine Dodrill" />
|
||||||
<meta name="twitter:description" content="Full-stack Engineer" />
|
<meta name="twitter:description" content="Full-stack Engineer" />
|
||||||
|
|
||||||
|
@ -76,10 +80,12 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/Xe" rel="me">GitHub</a></li>
|
<li><a href="https://github.com/Xe" rel="me">GitHub</a></li>
|
||||||
<li><a href="https://twitter.com/theprincessxena" rel="me">Twitter</a></li>
|
<li><a href="https://twitter.com/theprincessxena" rel="me">Twitter</a></li>
|
||||||
<li><a href="https://mst3k.interlinked.me/@cadey" rel="me">Mastodon</a></li>
|
<li><a href="https://mst3k.interlinked.me/@@cadey" rel="me">Mastodon</a></li>
|
||||||
<li><a href="https://www.patreon.com/cadey" rel="me">Patreon</a></li>
|
<li><a href="https://www.patreon.com/cadey" rel="me">Patreon</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Looking for someone for your team? Check <a href="/signalboost">here</a>.
|
<p>Looking for someone for your team? Check <a href="/signalboost">here</a>.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@:footer_html()
|
||||||
|
|
Loading…
Reference in New Issue