0.1.2 • Published 8 years ago

faiqu v0.1.2

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

faiqu

fetch for restful api

Install

npm i faiqu --save

Simple example

import faiqu from 'faiqu'

faiqu('/api').params({id:1}).get().then(res=>{ console.log(res) })

APIs

Init Api

  1. faiquInit.baseUrl(url:string)

    If the parameters you passed in the faiqu method are ' http://xxxx ', the method does not take effect

  2. faiquInit.preMethod(Array< Function >)

  3. faiquInit.defaultData(data:{})

    key:string=>value:Function

  4. faiquInit.defaultHeader(data:{})

    default:{ 'Content-type': 'application/x-www-form-urlencoded' }

  5. faiquInit.defaultParams(data:{})

    default:{credentials: 'include' }

  6. faiquInit.err_catch(param:Function)

    This method only applies to the error in the faiqu object and the error in preMethod

First Level

  1. faiqu (url:string)

Initialize a faiqu object as the request url

Second Level

  1. params(data:{})
  2. json ()

    set requeset header 'Content-type'=>'application/json'

  3. headers(data:{})

Third Level

  1. get()
  2. post ()
  3. put (id?:string)
  4. delete(id?:string)
0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago