#iron #deprecated #resource #endpoint #id-type #body #res-tlike

reep

[deprecated] REsource EndPoint (REEP): Generic Iron Endpoint for RESTlike Resource Access

2 unstable releases

Uses old Rust 2015

0.2.0 Sep 12, 2016
0.1.1 Oct 9, 2015

#24 in #id-type

32 downloads per month
Used in 3 crates

MIT/Apache

19KB
302 lines

Deprecation Note

This crate was originally meant to be a starting point for a more sophisticated REST(like) api project. But due to schedule changes this will no longer be realised. Through I have updated it to be compatible with a newer Iron version (0.4) further updates cant be expected.

REsource EndPoint (REEP) [deprecated]

Provides a ResourceEndpointBuilder witch allows you to easily build RESTlike resource based endpoints.

This implementation uses static constraints to assure that e.g. if a resource replacing handler is called the query options are parsed/valid, the resource id in the url is parsed/valid and the body is parsed/valid.

All parsed elements (option(=queryparameter), id and body) will be put into the request extensions typemap using the statically provided types. Note that it is assured that the BodyParser creates a resource witch's id type is the same as that of the parsed id.

State of the Project

  • basic functionality is working
  • documentation exists for all parts but could be improved (e.g. examples)
  • minimal http/options hander are generated if not provided
  • head request have to be handled manually (HttpHead ResourceMethod)
  • some default/generic option/id/body implementations exist in additional repos
  • no TravisCI integration yet
  • not published on crates.io yet
  • no tests yet expect a working example

Utils / Preimplementated Parts

There are some existing reusable implementations for some of the reep::types-Traits:

Example

A full example, using reep as well as some reep-* utility crates, can be found in the reep-example repo. Additionally here is a schematic usage example:


let ep = ResourceEndpointBuilder::new(optionParser, bodyParser)
  .create(ironHandlerForCreating)
  .list(ironHandlerForListing)
  .delete(ironHanderForDeleting)
  .replace(ironHandlerForReplacing)
  .get(ironHanderForGeting)
  .finalize();

app.mount("/users", ep);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~5.5MB
~132K SLoC