Create a JavaScript wrapper for the XML API created by rails?

I work with a large site written in Ruby on Rails. Thanks to REST support in Rails 2, site business logic is accessible through a consistent XML API. Now I want to be able to easily write one or more JavaScript interfaces to a site that interacts with the created Rails XML interface.

Ideally, an automatic wrapper for an API can be created in JavaScript, as this minimizes the effort required to write XML processing code for more than 500 API functions. How then can I automatically generate a wrapper around this XML-API in JavaScript to make it more enjoyable to work? I have worked with Java solutions that generate classes and methods for porting the API, so my current thinking is that I want something like this for JavaScript. However, I would be ready for an alternative solution to the problem.

+4
source share
1 answer

There's a great tool for the thinker called jester : a JavaScript REST implementation with syntax modeled after ActiveResource. You can use it to write code to read, create and update data on your server.

You can find some examples on the usage page .

+2
source

Source: https://habr.com/ru/post/1306986/


All Articles