You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To continue the example above, fetching all todo items for the example Todo app is done through the following API call:
/api/todo
But in order to abstract that, so developers don't have to look up the API URL (and any parameters, if required, such as page, order, filter, etc), we create a service method and wrap the HTTP call:
// Example WITHOUT Paris!classTodoService{getTodoItems():Promise<TodoItem[]>{returnfetch('/api/todo').then(data=>data.map(item=>newTodoItem(item)));}}
If we assume authentication is solved (a cookie might be set in advance), the above should be fine. However, as our app grows, we'll need more and more of these methods, at least one for each data type.
For example, we'd need getTodoLists to get all the todo lists, saveTodoItem to create a todo item or update one, deleteTodoItem for deleting one, etc.
Paris eliminates the need to define all these methods, since all CRUD operations are built into the library.