@21epub/epub-data-client

data api client for epub

Usage no npm install needed!

<script type="module">
  import 21epubEpubDataClient from 'https://cdn.skypack.dev/@21epub/epub-data-client';
</script>

README

@21epub/epub-data-client

data api client for epub

NPM JavaScript Style Guide Build Status Codecov

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-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