/Octane

A web server modeled after express in Rust.

Primary LanguageRustMIT LicenseMIT

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.

  • Multithreaded 🚄
  • Asynchronous design 🐆
  • Easy to use, intuitive design 🌱
  • TLS enabled, rustls/openssl ready 🔒
  • Minimal dependencies (working to reduce them more!) 💕

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

  • Http2
  • Stable SSL support
  • Efficient error handling (using enums instead of Box<dyn Error>)
  • Web socket library
  • Multipart/json form handling (being worked on)
  • Logging
  • Much more....

Contribute

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

License

OctaneWeb/Octane is licensed under the MIT License.