Crate cataclysm

Crate cataclysm 

Source
Expand description

§Cataclysm: A simple http framework

Cataclysm is a small personal project, an http framework influenced by actix-web, and built over tokio. A minimal working example is the following

extern crate cataclysm;
 
use cataclysm::{Server, Branch, http::{Response, Method}};
 
async fn index() -> Response {
    Response::ok().body("Hello, World!")
}
 
#[tokio::main]
async fn main() {
    let server = Server::builder(
        Branch::<()>::new("/").with(Method::Get.to(index))
    ).build().unwrap();
 
    server.run("localhost:8000").await.unwrap();
}

Modules§

http
Contains the specific functionality for http interaction
session
Contains usefull stuff for session management
wsws
Contains some basic websockets functionality

Structs§

Additional
Wrapper for additional shared data in the server
Branch
Main cataclysm structure for route handling
Cors
Inner cors structure
CorsBuilder
Cors builder structure
Server
Http Server instance
ServerBuilder
Builder pattern for the server structure
Shared
Wrapper around data to be shared in the server
Stream
Wrapper around a TCP Stream

Enums§

Error
Errors returned by this library
Pipeline
Pipeline type, contains either a layer or the core of the pipeline

Traits§

Callback
Callback trait, for http callbacks
Extractor
Extractor trait
StreamCallbackstream
StreamCallback trait, similar to a normal http callback but receives the TcpStream

Type Aliases§

CoreFn
Type for the core handlers, that is, the ones that actually create a response
LayerFn
Type representing middleware functions