4 ms·
Forward (http://getfwd.com http://getfwd.com) employs conventions like this between the template and model layers of an MVC style framework. get("/accounts
by ericingram 14y ago
Forward (http://getfwd.com http://getfwd.com) employs conventions like this between the template and model layers of an MVC style framework.
get("/accounts") // collection
get("/accounts", [limit => 10, page => 3]) // pagination
get("/accounts/email@address.com") // single record
get("/accounts/email@address.com/orders") // relations
get("/accounts/email@address.com/orders/10234/items/6/price") // deep relations
get("/accounts", [search => "john"]) // search
get("/accounts", [fields => "name, email"]) // partials
get("/accounts", [order => "name desc"]) // sorting
get("/accounts", [login => [...]]) // special conventions
post("/accounts", [alternate_email => $alt, ":validate" => [required => [alternate_email]]) // validation
put(...) // pretty much what you expect
delete(...) // same
The interesting thing about moving REST conventions to the model layer, is that you can suddenly create external facing APIs in various formats really easily. I'm hoping/expecting this will become a more common pattern.