serve index page
This commit is contained in:
parent
cb42d99c43
commit
db7998bbed
|
@ -2187,6 +2187,7 @@ dependencies = [
|
|||
"comrak",
|
||||
"envy",
|
||||
"log 0.4.8",
|
||||
"mime 0.3.16",
|
||||
"pretty_env_logger",
|
||||
"rand 0.7.3",
|
||||
"ructe",
|
||||
|
|
|
@ -13,6 +13,7 @@ comrak = "0.7"
|
|||
envy = "0.4"
|
||||
log = "0"
|
||||
pretty_env_logger = "0"
|
||||
mime = "0.3.0"
|
||||
rand = "0"
|
||||
ructe = "0.11"
|
||||
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 warp::Filter;
|
||||
use warp::{path, Filter};
|
||||
|
||||
pub mod app;
|
||||
pub mod handlers;
|
||||
pub mod signalboost;
|
||||
|
||||
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!"
|
||||
let hello = warp::path!("hello" / String).map(|name| format!("Hello, {}!", name));
|
||||
|
||||
warp::serve(hello.with(warp::log(APPLICATION_NAME)))
|
||||
.run(([127, 0, 0, 1], 3030))
|
||||
.await;
|
||||
let files = warp::path("static")
|
||||
.and(warp::fs::dir("./static"))
|
||||
.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(())
|
||||
}
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@()
|
||||
</div>
|
||||
<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>
|
||||
<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="canonical" href="https://christine.website/">
|
||||
<meta name="google-site-verification" content="rzs9eBEquMYr9Phrg0Xm0mIwFjDBcbdgJ3jF6Disy-k" />
|
||||
<script type="application/ld+json">
|
||||
@{
|
||||
"@context": "http://schema.org/",
|
||||
"@type": "Person",
|
||||
"@@context": "http://schema.org/",
|
||||
"@@type": "Person",
|
||||
"name": "Christine Dodrill",
|
||||
"alternateName": "Cadey, Xe, Xena",
|
||||
"url": "https://christine.website",
|
||||
|
@ -15,7 +19,7 @@
|
|||
"https://github.com/Xe",
|
||||
"https://git.xeserv.us/xena",
|
||||
"https://twitter.com/theprincessxena",
|
||||
"https://mst3k.interlinked.me/@cadey",
|
||||
"https://mst3k.interlinked.me/@@cadey",
|
||||
"https://www.linkedin.com/in/christine-dodrill-1827a010b/",
|
||||
"https://www.youtube.com/user/shadowh511"
|
||||
]
|
||||
|
@ -24,7 +28,7 @@
|
|||
|
||||
<!-- Twitter -->
|
||||
<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:description" content="Full-stack Engineer" />
|
||||
|
||||
|
@ -76,10 +80,12 @@
|
|||
<ul>
|
||||
<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://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>
|
||||
</ul>
|
||||
|
||||
<p>Looking for someone for your team? Check <a href="/signalboost">here</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@:footer_html()
|
||||
|
|
Loading…
Reference in New Issue