Is there a JavaScript library which allow me to perform all the REST operation like (GET
, POST
, PUT
and DELETE
over HTTP
or HTTPS
)?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
You can try restful.js, a framework-agnostic RESTful client, using a syntax similar to the popular Restangular.
You don't really need a specific client, it's fairly simple with most libraries. For example in jQuery you can just call the generic
$.ajax
function with the type of request you want to make:You can replace
PUT
withGET
/POST
/DELETE
or whatever.jQuery has JSON-REST plugin with REST style of URI parameter templates. According to its description example of using is the followin:
$.Read("/{b}/{a}", { a:'foo', b:'bar', c:3 })
becomes a GET to "/bar/foo?c=3".