Introducing npm Teams! Private packages + team management tools.Learn more »

kinka-serializy

0.0.3 • Public • Published

kinka + serializy

⚡️ Integration serializy with kinka ⚡️

🚀 Installation

$ npm i -S kinka-serializy
# or using yarn
$ yarn add kinka-serializy

📚 Usage

import kinka from 'kinka'
import KinkaSerializy from 'kinka-serializy'
 
 
const api = kinka.create({
  baseURL: 'https://your-api.com',
  middlewares: [
    KinkaSerializy
  ]
})
 
// ...
 
const { data } = await api.get('/client/1234', {
  model: ClientModel
})
 
console.log(data) // your serialized client model

Also if you want to serialize error messages from server you need to:

 
const api = kinka.create({
  baseURL: 'https://your-api.com',
  middlewares: [
    KinkaSerializy({
      errorModel: YourPrettifiedErrorModel
    })
  ]
})
 

📝 License

Licensed under the MIT License.

Install

npm i kinka-serializy

DownloadsWeekly Downloads

6

Version

0.0.3

License

MIT

Unpacked Size

26.4 kB

Total Files

12

Last publish

Collaborators

  • avatar