iron_json

Crates.ioiron_json
lib.rsiron_json
version1.0.0
sourcesrc
created_at2017-03-12 05:21:26.410732
updated_at2017-03-12 05:21:26.410732
descriptionIron JSON: A simplified approach to parsing JSON in Iron routes.
homepagehttps://github.com/ChrisCates/iron_json
repositoryhttps://github.com/ChrisCates/iron_json
max_upload_size
id8938
size1,978
Chris Cates (ChrisCates)

documentation

https://github.com/ChrisCates/iron_json

README

iron_json

Iron JSON: A simplified approach to parsing JSON in Iron routes.

By Chris Cates :star:

Why was Iron JSON built?

  • To make parsing JSON simpler for the Iron framework.
  • All that's required is one function to get a JSON value.

Cargo.toml

[package]
name = "iron_json"
version = "1.0.0"
authors = ["Chris Cates <hello@chriscates.ca>"]

[dependencies]
iron = "0.5.*"
json = "0.11.*"
bodyparser = "0.5.*"

API

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.

Example

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();
}

Published under GNU License. :)

Commit count: 0

cargo fmt