An open API service indexing awesome lists of open source software.

https://github.com/acacode/kinka-serializy

Integration kinka with serializy
https://github.com/acacode/kinka-serializy

javascript request xmlhttprequest

Last synced: 14 days ago
JSON representation

Integration kinka with serializy

Awesome Lists containing this project

README

          

kinka + serializy

[![](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE)
[![](https://img.shields.io/npm/v/kinka-serializy.svg)](https://www.npmjs.com/package/kinka-serializy)
[![](https://img.shields.io/travis/acacode/kinka-serializy.svg)](https://travis-ci.org/acacode/kinka-serializy)
[![](https://www.codefactor.io/repository/github/acacode/kinka-serializy/badge/master)](https://www.codefactor.io/repository/github/acacode/kinka-serializy/overview/master)
[![](https://img.shields.io/npm/dm/kinka-serializy.svg)](http://npm-stat.com/charts.html?package=kinka-serializy)
[![](https://badgen.net/bundlephobia/min/kinka-serializy)](https://bundlephobia.com/result?p=kinka-serializy)
[![](https://badgen.net/bundlephobia/minzip/kinka-serializy)](https://bundlephobia.com/result?p=kinka-serializy)


⚡️ Integration serializy with kinka ⚡️


## 🚀 Installation

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

## 📚 Usage

```js
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:

```js

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

```

## 📝 License

Licensed under the [MIT License](./LICENSE).