Consuming restoas restful webservice using javascript (framework)

Is it possible to use a hateful webservice type of hate through (a) javascript (a framework such as angularjs)? I believe that the client needs to implement quite a bit of logic to achieve the actual endpoint. Any feedback would be greatly appreciated. Thanks!

+4
source share
2 answers

Yes it is possible. Javascript is another user agent.

Yes, there is work. No, I do not know any frameworks for this. I wrote a toolkit for supporting applications for working with hypermedia on the desktop, and I do not consider it a significant amount of work to create an infrastructure for supporting applications based on hypermedia.

The task is not so much in equipment, but in the fact that this is a completely different approach to creating applications. This takes some time.

There is some work in the corresponding note in the browser / JS space that will simplify the work with applications that support hypermedia on the client. See NavigatingController . Currently, the JS user agent can only manage javascript links. Using the NavigatingController, it is also possible to intercept HTML links, which makes JS application applications smoother in the browser.

+1
source

At least part of the problem here is that your API should return a media type that supports structured binding (which usually uses the regular REST API by default, application/json and application/xml ). To get this support, check out HAL or JSONAPI projects.

Using a structured definition of links makes it much easier to consume - the HAL has several libraries for working with it, including the javascript library :

https://github.com/mikekelly/backbone.hal

For an interesting client, check out the HAL Talk demo .

+2
source

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


All Articles