#iot-data #iot #iot-platform #api

bin+lib sylvia-iot-data

The data storage of Sylvia-IoT core modules

54 releases

0.2.1 Jan 10, 2025
0.1.16 Dec 20, 2024
0.1.15 Sep 27, 2024
0.1.6 Jul 30, 2024
0.0.6 Mar 31, 2023

#169 in HTTP server

Download history 126/week @ 2024-12-19 123/week @ 2024-12-26 2/week @ 2025-01-02 264/week @ 2025-01-09 5/week @ 2025-01-16 1/week @ 2025-01-30 1/week @ 2025-02-06 3/week @ 2025-02-13 8/week @ 2025-02-20 7/week @ 2025-02-27

2,903 downloads per month

MIT license

1.5MB
45K SLoC

crates.io Documentation CI Coverage Docker License

sylvia-iot-data

The data storage of Sylvia-IoT core modules.

Documentation

Mount sylvia-iot-data in your axum App

You can simply mount sylvia-iot-data into your axum App:

use axum::Router;
use clap::App as ClapApp;
use std::net::SocketAddr;
use sylvia_iot_data::{libs, routes};
use tokio::{self, net::TcpListener};

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let args = ClapApp::new("your-project-name").get_matches();

    let conf = libs::config::read_args(&args);
    let data_state = match routes::new_state("/data", &conf).await {
        Err(e) => {
            println!("Error: {}", e);
            return Ok(());
        },
        Ok(state) => state,
    };
    let app = Router::new().merge(routes::new_service(&data_state));
    let listener = match TcpListener::bind("0.0.0.0:1080").await.unwrap();
    axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>()).await
}

Please see src/bin/sylvia-iot-data.rs to get the real world example.

All-in-one binary

You can use src/bin/sylvia-iot-core.rs as a single binary to run the whole sylvia-iot platform.

Dependencies

~92MB
~1.5M SLoC