Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

http-helpers-serializy

acacode2MIT0.0.1TypeScript support: included

helpers for http web clients for integration with serializy

axios, kinka, serializy, javascript, http, javascript-library

readme

Helpers for integration serializy with http web clients

HTTP client helpers serializy

🚀 Installation

$ npm i -S http-helpers-serializy
# or using yarn
$ yarn add http-helpers-serializy

📚 Usage


import {
  deserializeRequestData,
  serializeResponseData,
} from 'http-helpers-serializy'
import { field, model } from 'serializy'

const SerializyModel = model({
  foo: field('Foo', 'any'),
})

const ErrorModel = model({
  message: field(e => (e ? JSON.stringify(e) : '')),
})

const structure = { Foo: '12345' }

const method = 'get'
const url = 'https://api.com/my-data'

const { data } = deserializeRequestData(SerializyModel, structure, {
  method,
  url,
})

// ...

const { data, error } = serializeResponseData(SerializyModel, structure, {
  method,
  url,
  isError: false,
  errorModel: ErrorModel,
  error: { message: 'bad response' },
})

📝 License

Licensed under the MIT License.

changelog

CHANGELOG

0.0.1

Added

  • Created project
  • Added deserializeRequestData(), serializeResponseData() helpers