I tried to create a simple embed HTTP server in Rust using Actix Web for the Desktop Tauri app. However, I found a lot of problems and unable to perform a simple file upload operation and have Websocket without extra dependencies. None of the stackoverflow solution worked for me.
May be I am a Django Guy and found difficult to use Actix Web which may be my skill issue. So I thought to create my own web framework in Rust for embed projects.
Here's github link: https://github.com/tejmagar/rusty-web/
It is same like a Django's functional approach.
use rusty_web::paths::{Path, Paths};
use rusty_web::request::Request;
use rusty_web::response::Response;
use rusty_web::server::run_server;
fn home(request: Request, mut response: Response) {
response.html(200, "Home Page".to_string()).send();
}
fn about(request: Request, mut response: Response) {
response.html(200, "About Us".to_string()).send();
}
fn main() {
let paths: Paths = vec![
Path::new("/".to_string(), home),
Path::new("/about/".to_string(), about),
];
run_server("0.0.0.0:8080", paths);
}
I will be using this for my personal projects. Leave your suggestions to make this project better.