0.4.0 • Published 8 years ago
unserve-function v0.4.0
unserve-function
Generate a JavaScript function based on a REST API.
Installation
$ npm install unserve-function
Usage
;(function () {
var unserveFunction = require('unserve-function')
var API_URL = 'http://example.com/api'
var unservedFunction = unserveFunction(API_URL)
var apiOptions = {
queryParameter1: 'something',
queryParameter2: 3
}
// our function will do this
// http://example.com/api?queryParameter1=something&queryParameter2=3
unservedFunction(apiOptions, function(error, result){
console.log('Same results we get from using the REST API: ' result)
})
})()
Run Tests
$ npm test