gotham-cors-middleware

Crates.iogotham-cors-middleware
lib.rsgotham-cors-middleware
version0.2.1
sourcesrc
created_at2018-06-26 13:50:29.915008
updated_at2018-10-23 13:59:44.943513
descriptionA small crate to add basic CORS functionality to Gotham apps
homepage
repositoryhttps://github.com/simpleweb/gotham-cors-middleware
max_upload_size
id71780
size13,450
Andy Bell (Andy-Bell)

documentation

README

Gotham CORS Middleware

This library is aimed to provide CORS functionality to Gotham.rs servers.

Currently this is a very simple implementation with limited customisability.

Requires rust 1.26 or later.

Usage:

extern crate gotham;
extern crate gotham_cors_middleware;

use gotham::pipeline::new_pipeline;
use gotham_cors_middleware::CORSMiddleware;
use gotham::pipeline::single::single_pipeline;
use gotham::router::builder::*;
use gotham::router::Router;

pub fn router() -> Router {
    let (chain, pipeline) = single_pipeline(
        new_pipeline()
            .add(CORSMiddleware::default())
            .build(),
    );

    build_router(chain, pipeline, |route| {
     // Routes
    }
}

Roadmap:

  • Add integration tests
  • Add builder that would allow header customisation
  • Add documentation
  • See how next version of Gotham requires changes to middeware structure
Commit count: 17

cargo fmt