20 releases (11 breaking)

new 0.12.2 Dec 13, 2024
0.11.0 Dec 1, 2024
0.10.0 Oct 4, 2024
0.7.1 Feb 2, 2024
0.1.0 Oct 10, 2023

#103 in HTTP server

Download history 338/week @ 2024-08-22 212/week @ 2024-08-29 22/week @ 2024-09-05 54/week @ 2024-09-12 194/week @ 2024-09-19 70/week @ 2024-09-26 153/week @ 2024-10-03 12/week @ 2024-10-10 1/week @ 2024-10-17 161/week @ 2024-11-28 166/week @ 2024-12-05

327 downloads per month

MIT license

2MB
3.5K SLoC

rupring

GitHub license

Spring Comes to Rust

Get Started

required dependency list

rupring = "0.11.0"
serde = { version="1.0.193", features=["derive"] }

And you can write your server like this:

#[derive(Debug, Clone, Copy)]
#[rupring::Module(controllers=[HomeController{}], modules=[])]
pub struct RootModule {}

#[derive(Debug, Clone)]
#[rupring::Controller(prefix=/, routes=[hello, echo])]
pub struct HomeController {}

#[rupring::Get(path = /)]
pub fn hello(_request: rupring::Request) -> rupring::Response {
    rupring::Response::new().text("Hello, World!".to_string())
}

#[rupring::Get(path = /echo)]
pub fn echo(request: rupring::Request) -> rupring::Response {
    rupring::Response::new().text(request.body)
}

fn main() {
    rupring::run(RootModule {})
}

And if you run the program, it will work fine.
hello_world

More Details

Please refer to the documentation for more details.

Dependencies

~7–14MB
~171K SLoC