https://github.com/simpleweb/gotham-cors-middleware
A Gotham middleware library to provide Cross-Origin Resource Sharing (CORS) functionality
https://github.com/simpleweb/gotham-cors-middleware
gotham gotham-middleware gotham-rs rust
Last synced: 10 months ago
JSON representation
A Gotham middleware library to provide Cross-Origin Resource Sharing (CORS) functionality
- Host: GitHub
- URL: https://github.com/simpleweb/gotham-cors-middleware
- Owner: simpleweb
- License: other
- Created: 2018-06-21T12:52:04.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-07T01:38:28.000Z (over 5 years ago)
- Last Synced: 2025-08-31T21:42:02.315Z (11 months ago)
- Topics: gotham, gotham-middleware, gotham-rs, rust
- Language: Rust
- Homepage:
- Size: 22.5 KB
- Stars: 3
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Gotham CORS Middleware
This library is aimed to provide CORS functionality to [Gotham.rs](https://gotham.rs/) servers.
Currently this is a very simple implementation with limited customisability.
Requires rust 1.26 or later.
Usage:
```rust
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:
- [x] Add integration tests
- [x] Add builder that would allow header customisation
- [x] Add documentation
- [ ] See how next version of Gotham requires changes to middeware structure