unserve-function

0.4.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i unserve-function

Weekly Downloads

1

Version

0.4.0

License

MIT

Last publish

Collaborators

  • bagrounds