javascript - Does ECMAScript 6 have a native way to call REST Web Services -
i reading tutorial on web on es6 , pretty sure read there native way call rest web services using es6.
now googling on topic , cannot find it.
so in es6 still need libraries jquery/lodash etc make web service calls? or can make such calls using new language constructs?
sorry if faq. delete question if commonly asked... have tried searching , found nothing. sure read somewhere can call rest endpoint directly without external library.
es6 (aka es 2015) not have new api makes consuming rest services easier had been previously.
i suspect might looking new dom api aims replace xmlhttprequest called fetch. chrome , firefox implement api @ time of writing: http://caniuse.com/#feat=fetch
the fetch
api can polyfilled, here's one: https://github.com/github/fetch
more info on fetch api: https://developer.mozilla.org/en-us/docs/web/api/fetch_api http://github.github.io/fetch/
basic usage:
fetch('https://api.github.com/users') .then(response => response.json()) .then(users => console.log(users));
Comments
Post a Comment