@21epub/epub-data-client
v0.5.1
Published
data api client for epub
Downloads
116
Readme
@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
- [x] Easy-to-use
- [x] Typescript Only
- [x] RestFul data client support
- [x] Object Client support
- [x] Local data manupulate
- [x] Hooks for data client
- [x] Both for web and node supported
- [x] Uniform the error catch for both http error and response code error
Install
npm install --save @21epub/epub-data-client
Usage
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-peers
To run Example in hot module reloading mode:
npm start
To create a parcel example production build:
npm run build-prod
To create a bundle library module build:
npm run build
To update documentation
npm run doc
Running
Open the file dist/index.html
in your browser
Testing
To run unit tests:
npm test
License
MIT © 21epub