0.5.1 • Published 5 years ago
@21epub/epub-data-client v0.5.1
@21epub/epub-data-client
data api client for epub
Intro
Well, This is a data client for Epub . ( Can be reformed for other Usage )
Feature
- Easy-to-use
- Typescript Only
- RestFul data client support
- Object Client support
- Local data manupulate
- Hooks for data client
- Both for web and node supported
- Uniform the error catch for both http error and response code error
Install
npm install --save @21epub/epub-data-clientUsage
import { DataClient } from '@21epub/epub-data-client'
const client = new DataClient('http://url.to/data/')
client.getAll()
class Example extends Component {
data = client.useData()
render() {
return (
<>
<div> Total Data: {data?.length} </div>
</>
)
}
}For Details: See Example
Developing and running on localhost
First install dependencies and then install peerDeps for parcel dev:
npm install
npm run install-peersTo run Example in hot module reloading mode:
npm startTo create a parcel example production build:
npm run build-prodTo create a bundle library module build:
npm run buildTo update documentation
npm run docRunning
Open the file dist/index.html in your browser
Testing
To run unit tests:
npm testLicense
MIT © 21epub