kinka-serializy
v0.0.3
Published
integration kinka with serializy
Downloads
4
Maintainers
Readme
🚀 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.