Adding some simple tide scaffolding

This commit is contained in:
R Tyler Croy 2021-06-29 17:59:19 -07:00
parent e25b287be7
commit 983c9d0f47
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
3 changed files with 37 additions and 4 deletions

View File

@ -2,7 +2,14 @@
name = "geoffrey"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
authors = ["R Tyler Croy <rtyler@brokenco.de>"]
description = "The freshest butler in Bel-air"
[dependencies]
async-std = { version = "1", features = ["attributes", "tokio1"] }
dotenv = "*"
handlebars = { version = "4", features = ["dir_source"] }
log = "*"
pretty_env_logger = "0.3"
#sqlx = { version = "0.5", features = ["chrono", "json", "offline", "postgres", "uuid", "runtime-async-std-rustls"] }
tide = "*"

0
projects.d/.gitignore vendored Normal file
View File

View File

@ -1,3 +1,29 @@
fn main() {
println!("Hello, world!");
#[async_std::main]
async fn main() -> Result<(), std::io::Error> {
dotenv::dotenv().ok();
pretty_env_logger::init();
#[cfg(debug_assertions)]
{
info!("Activating DEBUG mode configuration");
}
if let Some(fd) = std::env::var("LISTEN_FD")
.ok()
.and_then(|fd| fd.parse().ok())
{
/*
* Allow the use of catflag for local development
* <https://github.com/passcod/catflap>
*/
use std::net::TcpListener;
use std::os::unix::io::FromRawFd;
app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?;
} else {
app.listen("0.0.0.0:8000").await?;
}
Ok(())
}