I am more of a backend guy, but frontend development really intrigues me as I make my first steps in seeing the browser as the environment for rich and awesome applications.
What is the most suitable Javascript framework for working with a RESTful HTTP API, in other words, for retrieving (HTTP GET) and submitting (HTTP POST/PUT/DELETE) JSON representations of resources?
I am looking for a framework (if it exists!) that provides good abstraction and encapsulation of HTTP request/response, handles cross-domain and cross-browser issues.
LoopBack. js. LoopBack is a highly-extensible, open-source Node. js framework that enables developers to create dynamic end-to-end REST APIs with little or no coding.
Node. js has large and active community that contribute many useful and mature modules which can be easily included and used. For example, to construct REST API such known modules as express, restify and hapi fit perfectly.
RESTful APIs can also be designed using programming languages like JavaScript or Python. While REST can be used over nearly any protocol, it is most commonly used for Web APIs over HTTP protocol.
Take a look at Backbone.js http://documentcloud.github.com/backbone/
Its lightweight, does not have many dependencies (only Underscore.js) and its real easy to use, yet pretty flexible and powerful.
From the site;
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
You can use jQuery with its .ajax() function. Example:
$.ajax({
url: '/users',
type: 'PUT',
data: { name: 'John Doe', age: 30 },
success: function ( data ) {
alert('John Doe inserted!');
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With