Crates.io | iron_json |
lib.rs | iron_json |
version | 1.0.0 |
source | src |
created_at | 2017-03-12 05:21:26.410732 |
updated_at | 2017-03-12 05:21:26.410732 |
description | Iron JSON: A simplified approach to parsing JSON in Iron routes. |
homepage | https://github.com/ChrisCates/iron_json |
repository | https://github.com/ChrisCates/iron_json |
max_upload_size | |
id | 8938 |
size | 1,978 |
[package]
name = "iron_json"
version = "1.0.0"
authors = ["Chris Cates <hello@chriscates.ca>"]
[dependencies]
iron = "0.5.*"
json = "0.11.*"
bodyparser = "0.5.*"
iron_json::parse(&mut iron::Request)
Takes the request object from the request and parses it into a JSON object.
Designed specifically for the json
crate.
extern crate iron;
use iron::prelude::*;
use iron::status;
extern crate iron_json;
use iron_json::parse;
fn main() {
Iron::new(
|req: &mut Request| {
let body = parse(req);
Ok(Response::with((status::Ok, format!("{}", body))))
}
).http("0.0.0.0:3000").unwrap();
}