rohanasan 0.5.2

An extremely fast backend framework for rust! Built from scratch using async-std, easy to use and asynchronous. Available for multiple programming languages and cross-platform.
Documentation

Rohanasan: An extremely fast backend framework built for rust

Made with Performance, optimization and ease of use in mind.

Currently available in C/C++/Rust programming languages only.

This library has been built from scratch using async-std.

How to use in your project?

  • Open terminal inside the parent folder where you would like to create the folder of your project
  • Run:
cargo new myproj
cd myproj
cargo add rohanasan
  • For a start you can add this to main.rs:
use rohanasan::{
    rohanasan, send_http_response, serve, Request, DEFAULT_HTML_HEADER,
};
fn handle(req: Request) -> String {
    send_http_response(DEFAULT_HTML_HEADER, "<h1>Hello!</h1>", req.data)
}

fn main() {
    rohanasan! {
        serve(8080, handle)
    }
}

  • cargo run to run your project.
  • Go to: localhost:8080.
  • Enjoy using Rohanasan!

How to run the example?

git clone https://github.com/rohanasan/rohanasan-rs.git
cd rohanasan-rs
cd examples
cargo run --example standard

Discord server link:

https://discord.gg/Yg2A3mEret

Performance:

Program used: hello_world.rs in examples folder

OS: Garuda Linux x86_64
Host: Inspiron 5590
Kernel: 6.5.9-zen2-1-zen
Uptime: 3 hours, 37 mins
Battery: 50%% [Discharging]

Packages: 1211 (pacman)[stable]
Shell: fish 3.6.1
Terminal: konsole 23.8.2

CPU: Intel(R) Core(TM) i3-10110U (4) @ 4.10 GHz
GPU: Intel UHD Graphics
Memory: 1.76 GiB / 11.48 GiB (15%)


╭─rohanv@rohan in repo: untitled1 on  master [!] is  v0.4.91 via  v1.76.0
╰─λ wrk -t 2 -c 100 http://localhost:8080/
Running 10s test @ http://localhost:8080/
2 threads and 100 connections
Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     0.97ms  580.92us   5.84ms   69.93%
Req/Sec    23.68k     1.67k   26.28k    62.00%
471375 requests in 10.02s, 42.26MB read
Requests/sec:  47057.83
Transfer/sec:      4.22MB

Current Features:

  • Can run a server at a specified port
  • Can serve a folder named static at /static
  • Can send files as http response
  • Can give you the path, method and protocol

TODO:

  • Add feature to change the directory path of the public folder ☑️ Done!!!!
  • Asynchronous file request handling ☑️ Done!!!!
  • Add feature to give the user an option to add index.html to static folder ☑️ Done!!!!
  • Add feature of request.post_request()
  • Add feature to... currently it's just a pre alpha release I have to add a lot of features right now!

Contribute:

https://www.buymeacoffee.com/rohanvashisht

Please star rohanasan's github repo:

https://github.com/rohanasan/rohanasan-rs