Skip to content

koaxjs/fetch-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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