tsukuyomi icon indicating copy to clipboard operation
tsukuyomi copied to clipboard

Asynchronous Web framework for Rust

trafficstars
header

Asynchronous Web framework for Rust.


Crates.io Minimal Rust Version: 1.31.0 Build Status Coverage Status Gitter

Features

  • Type-safe and composable handlers based on Extractor system
  • Scoped routing and middlewares
  • Asynchronous HTTP server based on tokio, hyper and tower-service
    • HTTP/1.1 protocol upgrade
    • Both of TCP and Unix domain socket support
    • TLS support (with native-tls, rustls or openssl)

Usage

use {
    std::net::SocketAddr,
    tsukuyomi::{
        App,
        config::prelude::*,
    },
    tsukuyomi_server::Server,
};

fn main() -> tsukuyomi_server::Result<()> {
    let app = App::create(
        path!("/")
            .to(endpoint::reply("Hello, world.\n"))
    )?;

    let addr = SocketAddr::from(([127, 0, 0, 1], 4000));
    println!("Listening on http://{}", addr);

    Server::new(app).bind(addr).run()
}

Resources

Extensions

  • tsukuyomi-askama - template support using askama
  • tsukuyomi-cors - CORS support
  • tsukuyomi-juniper - GraphQL integration using juniper
  • tsukuyomi-session - session management
  • tsukuyomi-tungstenite - WebSocket support using tungstenite

License

Tsukuyomi is licensed under either of MIT license or Apache License, Version 2.0 at your option.