16 releases (9 breaking)

0.10.0 Oct 4, 2024
0.8.2 Aug 28, 2024
0.7.1 Feb 2, 2024
0.6.0 Dec 27, 2023
0.1.0 Oct 10, 2023

#194 in HTTP server

Download history 2/week @ 2024-07-31 74/week @ 2024-08-14 220/week @ 2024-08-21 356/week @ 2024-08-28 28/week @ 2024-09-04 48/week @ 2024-09-11 190/week @ 2024-09-18 73/week @ 2024-09-25 154/week @ 2024-10-02 17/week @ 2024-10-09 2/week @ 2024-10-16

274 downloads per month

MIT license

2MB
3K SLoC

rupring

GitHub license

Spring Comes to Rust

Get Started

required dependency list

rupring = "0.9.1"
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
~172K SLoC