Created
March 17, 2018 19:32
-
-
Save Kelin2025/7f07bd0f7bdc138dde512fe5275f5d9c to your computer and use it in GitHub Desktop.
Apicase rest tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from '@apicase/adapter-fetch' | |
import { ApiService } from '@apicase/core' | |
import { ApiTree, restWrapped } from '@apicase/services' | |
const Root = new ApiService(fetch, { url: '/api' }) | |
const api = new ApiTree(Root, [ | |
/* Equal with previous example */ | |
restWrapped('posts'), | |
/* Pick only specified routes */ | |
restWrapped('posts', ['getAll']), | |
/* With custom URL's and additional payload */ | |
restWrapped('posts', { getAll: { url: 'get_all' } }), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment