Join the Stack Overflow Community
Stack Overflow is a community of 6.8 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

In the example TodoMVC, I understand I can hook into the fetch and save function to use jQuery Ajax Get/Post to interact with backend APIs for remote storage.

e.g.

var todoStorage = {
  fetch: function () {
    var todos = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')
    todos.forEach(function (todo, index) {
      todo.id = index
    })
    todoStorage.uid = todos.length
    return todos
  },
  save: function (todos) {
    localStorage.setItem(STORAGE_KEY, JSON.stringify(todos))
  }
}

But since my backend is already restful API, are there any more elegant way to map my Restful Apis more neatly?

share|improve this question

Yes. You can use any AJAX library, like Vue-resource and use: Vue.$http.post to save data and Vue.$http.get to get data. Simple like that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.