aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index d31abfe..6b48957 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,18 +1,20 @@
1use anyhow::Result; 1use anyhow::Result;
2use hyper::service::{make_service_fn, service_fn}; 2use hyper::service::{make_service_fn, service_fn};
3use hyper::Server; 3use hyper::Server;
4use log::trace;
4 5
5mod db; 6mod db;
6mod service; 7mod service;
7use service::shortner_service; 8use service::shortner_service;
8 9
9fn main() -> Result<()> { 10fn main() -> Result<()> {
11 pretty_env_logger::init();
10 smol::run(async { 12 smol::run(async {
11 let addr = ([127, 0, 0, 1], 3000).into(); 13 let addr = ([127, 0, 0, 1], 3000).into();
12 let service = 14 let service =
13 make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(shortner_service)) }); 15 make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(shortner_service)) });
14 let server = Server::bind(&addr).serve(service); 16 let server = Server::bind(&addr).serve(service);
15 println!("Listening on http://{}", addr); 17 trace!("Listening on http://{}", addr);
16 server.await.unwrap(); 18 server.await.unwrap();
17 Ok(()) 19 Ok(())
18 }) 20 })