octane

Crates.iooctane
lib.rsoctane
version0.1.2
sourcesrc
created_at2020-06-11 21:17:29.021682
updated_at2020-09-01 10:47:13.788564
descriptionA web server built from the ground up.
homepagehttps://github.com/OctaneWeb/Octane
repository
max_upload_size
id253001
size174,314
weegee (Daksh14)

documentation

README

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 🌱
  • Minimal dependencies (working to reduce them more!) 💕

Basic Usage

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

use octane::config::Config;
use octane::responder::StatusCode;
use octane::server::Octane;
use octane::{
    route,
    router::{Flow, Route},
};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut app = Octane::new();
    app.ssl(8001)
        .key("templates/key.pem")
        .cert("templates/cert.pem");
    app.get(
        "/to_home",
        route!(|req, res| {
            res.redirect("/").send("redirecting");
            Flow::Stop
        }),
    )?;

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

    app.add(Octane::static_dir("templates/"))?;
    app.listen(8000)
}

Docs

Documentation will be available on docs.rs and on the offical Octane Site.

Contribute

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

License

OctaneWeb/Octane is licensed under the MIT License.

Commit count: 0

cargo fmt