0.4.0 • Published 8 years ago

unserve-function v0.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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
0.4.0

8 years ago

0.3.1

8 years ago