rohanasan 0.5.1

An extremely fast backend framework for rust! Built from scratch, easy to use and asynchronous. Available for multiple programming languages and platforms like unix, linux, mac, FreeBSD. Made using web sockets.
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.

Please use a linux/unix/mac kind of os.

This library has been built from scratch.

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 {
    if req.path == "/" {
        send_http_response(DEFAULT_HTML_HEADER, "<h1>Hello!</h1>", req.data)
    }
    else {
        send_http_response(DEFAULT_HTML_HEADER, "<h1>404</h1>", req.data)
    }
}

fn main() {
    rohanasan! {
        serve("0.0.0.0:8080", handle).await;
    }
}
  • 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 example

Performance:

wrk -t 2 -c 100 http://127.0.0.1:8080
Running 10s test @ http://127.0.0.1:8080
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.34ms  544.14us   6.06ms   92.15%
    Req/Sec    13.72k     8.08k   20.62k    83.33%
  16425 requests in 10.09s, 1.49MB read
Requests/sec:   1627.75
Transfer/sec:    151.01KB

Discord server link:

https://discord.gg/Yg2A3mEret

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
  • Add statistics of performance.
  • 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