https://github.com/alexkrolick/todo-mvc-service
mock API for TodoMVC apps
https://github.com/alexkrolick/todo-mvc-service
todo-mvc todomvc
Last synced: 3 months ago
JSON representation
mock API for TodoMVC apps
- Host: GitHub
- URL: https://github.com/alexkrolick/todo-mvc-service
- Owner: alexkrolick
- License: mit
- Created: 2017-09-10T23:40:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-12T05:06:37.000Z (almost 8 years ago)
- Last Synced: 2025-04-02T00:11:41.408Z (3 months ago)
- Topics: todo-mvc, todomvc
- Language: JavaScript
- Size: 72.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Todo MVC Service
A mock API for [TodoMVC](http://todomvc.com/) 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.
## Demo
- [TodoMVC With Create-React-App](http://alexkrolick.github.io/todo-mvc-service-demo) ([src](https://github.com/alexkrolick/todo-mvc-service-demo/blob/master/src/App.js))
## Quick Start
```js
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))
```## Routes
```js
console.log(Todo.routes)
``````
└── /
└── todos (GET|POST)
└── /
└── :id (GET)
:id (PUT)
:id (DELETE)
```## Known Issues
- ~~~Does not work with UglifyJS, so [create-react-app's prod mode does not work](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify). I'm looking into changing the webpack config to transpile the dependencies (PR welcome... for the webpack experts in the audience 😃).~~~ Fixed by forking and transpiling the router.
- Needs tests