9 releases
| 0.3.3 | May 16, 2019 |
|---|---|
| 0.3.2 | Apr 25, 2019 |
| 0.3.1 | Mar 1, 2019 |
| 0.3.0 | Feb 15, 2019 |
| 0.1.0 | Apr 23, 2018 |
#2474 in HTTP server
51 downloads per month
10KB
129 lines
nickel_cors is a middleware for nickel.rs
for more tech detail, see MDN CORS
Install
Add this line to your Cargo.toml
nickel_cors = "0.3.3"
Usage
It's simple.
/* get server instance */
extern crate nickel;
use nickel::Nickel;
let mut server = Nickel::new();
/* enable cors */
extern crate nickel_cors;
server.utilize(nickel_cors::enable_cors);
This middleware will add these CORS headers to your every response:
-
Access-Control-Allow-Methods: * -
Access-Control-Allow-Origin: * -
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept -
Access-Control-Max-Age: 86400
Dev & Test
first you need install or switch to stable rust version.
rustup default stable
runing test use under line, or it will be failed.
cargo test
Dependencies
~9MB
~175K SLoC