diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 4 |
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 @@ | |||
1 | use anyhow::Result; | 1 | use anyhow::Result; |
2 | use hyper::service::{make_service_fn, service_fn}; | 2 | use hyper::service::{make_service_fn, service_fn}; |
3 | use hyper::Server; | 3 | use hyper::Server; |
4 | use log::trace; | ||
4 | 5 | ||
5 | mod db; | 6 | mod db; |
6 | mod service; | 7 | mod service; |
7 | use service::shortner_service; | 8 | use service::shortner_service; |
8 | 9 | ||
9 | fn main() -> Result<()> { | 10 | fn 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 | }) |