This is a web application built using Rust and Axum. It provides a RESTful API for managing modbus registers and file uploads.
We used Rust because we wanted to build this API as a dll file so we can use it from the T3000_Building_Automation_System C++ code.
Rust: a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Axum: a web framework for Rust that provides a simple and composable API for building web applications. Sea-ORM: a database management system for Rust that provides an easy-to-use ORM for working with databases.
To get started with the project, you'll need to have Rust and Cargo installed on your system. You can download Rust from the official website (https://www.rust-lang.org/) and follow the installation instructions.
We build the project as 32bit binary for Windows because it will be used in the T3000 C++ code which is 32bit.
bashcargo build --target i686-pc-windows-msvc --release
You will find the compiled binary in the target/i686-pc-windows-msvc/release
directory.
You can use this example to test the API before you ship it as a dll file.
bashcargo run --example run_server --release
bashcargo test -- --test-threads 1
Database migrations are handled by Sea ORM.
bashcargo install sea-orm-cli
To run the migration, run the following command:
bashsea-orm-cli migrate up
To add a new migration, run the following command:
bashsea-orm-cli migrate generate <migration_name>
If you change the database schema, you'll need to regenerate the Sea-ORM entities. To do this, run the following command:
bashsea-orm-cli generate entity -o src/entity