Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a fully implemented REST javascript client? [closed]

I've been experimenting with and researching javascript clients for RESTful web services. Just about everything I've seen seems to be limited to the recreating model definitions in the client and doing CRUD on simple (non-related) models.

What I'm Looking For

  • Ability to dynamically create models (and/or proxies and/or stores) in the client given a URI to the JSONREST schema provided by the server API
  • Ability to handle relations natively (that is, without creating a bunch of custom functions or overriding much built-in functionality). I'm talking about 1->n, 1->1, n->1 and n->m relations.
  • Ability to work relatively well with a full feature client framework like ExtJS or Dojo.

What I've Tried

  • ExtJS 4.1: Great widget set, able to do completely programmatic layout, 'ajax'/'rest' proxies work out-of-the-box for simple models. No IRC or dev community that I can find, limited responsiveness on GPL forums.
  • Dojo [current]: Needs custom overriding to JsonRestStore to function with basic models. Great widgets, difficuly to completely avoid html.
  • I've also looked at various jquery based tools and a little at backbone.js (http://backbonejs.org is down at the moment.). The jquery stuff seems utterly disjointed to me. If there are good jquery REST tools, I'm open to them, I just need pointers to documentation on how to develop coherent and manageable apps with them.

Basic Goal

  • Developing web client apps that are maintainable over time and are "DRY". That is, there is as little copy-pasting of {param1: 'asdf', param2: 30, ...} throughout related "classes". Ideally, if it is defined on the server, the client should get it from the REST API. If it is defined in the client, other parts of the client should be able to inherit/extend that definition.

Another way of saying it:

  • Most JS Frameworks follow the MVC pattern. Which, to me, is silly since my "M" is already on the server along with some of the "C". I want my client to be a "Vc", to only recreate as much of the server-side model as is necessary for asynchronous operation focusing on UI presentation and user actions. Which means that ideally none of the "M" in "MVC" will be hard coded into the client.

Is there a full featured javascript REST client that someone can point me towards. Thanks.

like image 870
justinzane Avatar asked May 16 '12 16:05

justinzane


3 Answers

A few links you most likely want to look at:

Alternative URL for Backbonejs.org: http://documentcloud.github.com/backbone/

As you may know, Backbone creates Objects like Collections and Models based on your data.

Relational mapping: https://github.com/PaulUithol/Backbone-relational/

If you want to have relational data mapping in Backbone, follow the link above

JSON Schema Validator: https://github.com/garycourt/JSV

this is handy if you're worried about making sure you adhere to a certain JSON Schema, you can extend Backbone.js to validate a model client-side by overriding the validate method.

like image 65
Vincent Briglia Avatar answered Nov 15 '22 23:11

Vincent Briglia


Check out my Javascript JSON-Hyper-Schema client. It dynamically builds an HTML client app using Angular, by parsing the Schema provided at a given resources endpoint with the OPTIONS method.

https://github.com/bpanahij/passportedu_schema/tree/master/client

I have been working on a HATEOAS (Hypermedia as the engine of application state) API, using JSON Hyper Schema. You can go to the URL below, browse around, register, login and do some actions.

Check it out, here: http://direct.psprt.com:8081/

I also open sourced my actual API code thus far: https://github.com/bpanahij/passportedu_schema

Feel free to take a look, borrow, and comment.

[JSON Hyper Schema][1] (See Also [JSON-Schema][2])

like image 32
Brian P Johnson Avatar answered Nov 15 '22 23:11

Brian P Johnson


Try https://github.com/avoidwork/abaaso, I've heard nice things about it.

like image 40
alganet Avatar answered Nov 15 '22 23:11

alganet