Package Exports
- @request/api
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@request/api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@request/api
Use this module to create sugar API for your HTTP client. You can also allow your users to define their own method aliases.
var api = require('@request/api')
var client = require('@request/client')
var config = {
// HTTP verb methods
verb: {
get: ['select']
},
// option methods
option: {
qs: ['where'],
callback: ['done']
},
// custom methods
custom: {
submit: ['gimme']
}
}
function submit () {
// `this` contains the options object that you usually pass to @request/core
return client(this)
}
var request = api(config, submit)
request
.select('http://localhost:6767')
.where({a: 'b'})
.done((err, res, body) => {
// aaa
// mazing
})
.gimme()
See @request/core for more details.