aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/mod.rs
diff options
context:
space:
mode:
authorEllie Huxtable <e@elm.sh>2021-04-20 17:07:11 +0100
committerGitHub <noreply@github.com>2021-04-20 16:07:11 +0000
commit34888827f8a06de835cbe5833a06914f28cce514 (patch)
tree8b56f20e50065cd2c222d5e8e067ec55cf1947a1 /src/server/mod.rs
parentOptimise docker (#34) (diff)
downloadatuin-34888827f8a06de835cbe5833a06914f28cce514.zip
Switch to Warp + SQLx, use async, switch to Rust stable (#36)
* Switch to warp + sql, use async and stable rust * Update CI to use stable
Diffstat (limited to 'src/server/mod.rs')
-rw-r--r--src/server/mod.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs
new file mode 100644
index 00000000..d5e083df
--- /dev/null
+++ b/src/server/mod.rs
@@ -0,0 +1,23 @@
+use std::net::IpAddr;
+
+use eyre::Result;
+
+use crate::settings::Settings;
+
+pub mod auth;
+pub mod database;
+pub mod handlers;
+pub mod models;
+pub mod router;
+
+pub async fn launch(settings: &Settings, host: String, port: u16) -> Result<()> {
+ // routes to run:
+ // index, register, add_history, login, get_user, sync_count, sync_list
+ let host = host.parse::<IpAddr>()?;
+
+ let r = router::router(settings).await?;
+
+ warp::serve(r).run((host, port)).await;
+
+ Ok(())
+}