0.1.0 • Published 6 years ago

fettch v0.1.0

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

fettch

A simple promise fetch/XHR wrapper.

GitHub stars GitHub forks GitHub issues GitHub license

method, url, headers: {}, data: {}

Install

npm i -s fettch
import fettch from 'fettch'

or

import fettch from '//unpkg.com/fettch'

GET Example

fettch({
  url: '//jsonplaceholder.typicode.com/posts'
}).then(response => {
  console.log(response)
})

POST Example

fettch({
  method: 'POST',
  url: '/api/auth/signin',
  data: { 
    user,
    pass 
  },
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
}).then(data => {
  console.log(data)
}).catch(err => {
  console.log(err)
})

Cheers, Linus

0.1.0

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago