about summary refs log tree commit diff stats
path: root/crates/rocie-server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rocie-server/src/main.rs')
-rw-r--r--crates/rocie-server/src/main.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/rocie-server/src/main.rs b/crates/rocie-server/src/main.rs
index c896c35..8e71034 100644
--- a/crates/rocie-server/src/main.rs
+++ b/crates/rocie-server/src/main.rs
@@ -22,9 +22,12 @@ async fn main() -> Result<(), std::io::Error> {
             api::get::product::products,
             api::get::unit::units,
             api::get::unit::unit_by_id,
+            api::get::inventory::amount_by_id,
             api::set::product::register_product,
             api::set::product::associate_barcode,
             api::set::unit::register_unit,
+            api::set::barcode::buy_barcode,
+            api::set::barcode::consume_barcode,
         ),
     // security(
     //     (),
@@ -39,11 +42,13 @@ async fn main() -> Result<(), std::io::Error> {
     let args = CliArgs::parse();
 
     match args.command {
-        Command::Serve => {
-            let host = "127.0.0.1";
-            let port = 8080;
+        Command::Serve {
+            host,
+            port,
+            db_path,
+        } => {
             let data = Data::new(
-                app::App::new()
+                app::App::new(db_path)
                     .await
                     .map_err(|err| std::io::Error::other(main::Error::AppInit(err)))?,
             );
@@ -52,7 +57,9 @@ async fn main() -> Result<(), std::io::Error> {
 
             HttpServer::new(move || {
                 App::new()
-                    .wrap(Logger::new(r#"%a "%r" -> %s %b ("%{Referer}i" "%{User-Agent}i" %T s)"#))
+                    .wrap(Logger::new(
+                        r#"%a "%r" -> %s %b ("%{Referer}i" "%{User-Agent}i" %T s)"#,
+                    ))
                     .app_data(Data::clone(&data))
                     .configure(api::get::register_paths)
                     .configure(api::set::register_paths)