# 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 tokio.
# How to use in your project?
- Open terminal inside the parent folder where you would like to create the folder of your project
- Run:
```shell
cargo new myproj
cd myproj
cargo add rohanasan
```
- For a start you can add this to main.rs:
```rust
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?
```shell
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:
| OS | Garuda Linux x86_64 |
| Host | Inspiron 5590 |
| Kernel | 6.5.9-zen2-1-zen |
| 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%) |
| Thread Stats | |
| Avg Latency | 0.97ms |
| Latency Stdev | 580.92us |
| Max Latency | 5.84ms |
| +/- Latency Stdev | 69.93% |
| Avg Req/Sec | 23.68k |
| Req/Sec Stdev | 1.67k |
| Max Req/Sec | 26.28k |
| +/- Req/Sec Stdev | 62.00% |
| Total Requests | 471375 |
| Data Transferred | 42.26MB |
| 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