summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 1947ff8..4a5a8b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,28 +1,27 @@
+use crate::config::CONFIG_INSTANCE;
+use crate::error::TwinHError;
use hyper::{
service::{make_service_fn, service_fn},
Server,
};
-use std::convert::Infallible; // TODO:
mod config;
mod error;
-mod handlers;
mod models;
mod repo;
+mod routes;
mod templates;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
- let addr = config::INSTANCE.addr;
+ let addr = CONFIG_INSTANCE.addr;
- let make_svc = make_service_fn(move |_conn| async {
- Ok::<_, Infallible>(service_fn(|req| handlers::router(req)))
- });
+ let make_svc =
+ make_service_fn(move |_conn| async { Ok::<_, TwinHError>(service_fn(routes::router)) });
let server = Server::bind(&addr).serve(make_svc);
let graceful = server.with_graceful_shutdown(shutdown_signal());
- // run until shutdown signal
if let Err(e) = graceful.await {
eprintln!("server error: {}", e);
}