REST requests?
Closed this issue · 2 comments
gavinengel commented
How should I integrate REST API calls to a with Espresso? Are there any recommended libraries, or even examples?
akrymski commented
You can use any library you like to fetch data and update espresso collections/models. Personally I like superagent and fetch but jQuery's ajax function is fine too if you're already using jQuery in your project. Example using superagent:
var collection = new Espresso.Collection();
request.get('/posts').end(function(err, res) {
// update the collection which triggers events as necessary
collection.set(res)
});
gavinengel commented
Thanks!