OctaneWeb / Octane

A web server modeled after express in Rust.
MIT License
139 stars 5 forks source link
http http-server https octane rust rust-crate web webserver

Octane 🚀

A high-powered web server aimed at minimizing dependencies while maintaining speed. Modeled after Express, a popular Javascript web framework, Octane combines the speed of Rust with the ease-of-use and flexibility of Express to create the optimal user experience.

Not production ready

The web server is not production ready yet, there are many things left to do before we are production ready. Use at your own risk! Development is being done right now, lots of things are untested in the library. If you would like to report any details, use issues or the chat!

Basic Usage

Create an octane instance, and then you can register your methods on it using app.METHOD()

use octane::prelude::*;
use std::error::Error;

#[octane::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut app = Octane::new();
    app.ssl(8001)
        .key("templates/key.pem")
        .cert("templates/cert.pem"); // Setup ssl

    app.get(
        "/",
        route!(|req, res| {
            res.send_file("templates/test.html").expect("File not found!");
            Flow::Next
        }),
    )?;

    app.add(Octane::static_dir(path!("/templates/")))?;
    app.listen(8000, || println!("Server Started!")).await
}

Docs

Documentation will be available on docs.rs.

Roadmap to production

Contribute

Checkout CONTRIBUTING.md for info on how to contribute to this project

License

OctaneWeb/Octane is licensed under the MIT License.