A mock API for TodoMVC apps. Provides a fetch
method with a similar API to window.fetch. Persists data to localStorage, with a random delay to simulate a network connection.
import Todo from 'todo-mvc-service'
Todo.fetch('/todos', {
method: 'POST',
body: {
title: 'Buy milk',
completed: false,
}
})
Todo
.fetch('/todos')
.then(res => res.json())
.then(todos => console.log('todos', todos))
console.log(Todo.routes)
└── /
└── todos (GET|POST)
└── /
└── :id (GET)
:id (PUT)
:id (DELETE)
-
- Needs tests