0.1.1 • Published 9 years ago

@koax/fetch-json v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

fetch-json

Build status Git tag NPM version Code style

Fetch json sugar.

Installation

$ npm install @koax/fetch-json

Usage

import koax from 'koax'
import {fetchEffect} from '@koax/fetch'
import {post} from '@koax/fetch-json'

let app = koax()

app.use(fetchEffect)

app(post('https://slack.com/api/chat.postMessage', {
  token: 'secret',
  channel: 'C1234567890',
  text: 'Hello world'
})).then(res => res.body) // {ok: true ...}

API

get(url, params)

  • url - url string
  • params - parameters to put in body (should we put in url for get?)

Returns: FETCH action

post(url, params)

  • url - url string
  • params - parameters to put in body

Returns: FETCH action

License

MIT