diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-23 08:33:06 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-23 08:34:45 +0200 |
| commit | 2dc74d621399be454abbbff892fb46204ddc6e7b (patch) | |
| tree | f9525527fc09c465d4e2e4a4f665bfd444b889f8 /crates/rocie-server/src/main.rs | |
| parent | feat: Provide basic barcode handling support (diff) | |
| download | server-2dc74d621399be454abbbff892fb46204ddc6e7b.zip | |
feat(treewide): Add tests and barcode buying/consuming
Diffstat (limited to 'crates/rocie-server/src/main.rs')
| -rw-r--r-- | crates/rocie-server/src/main.rs | 17 |
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) |
