serve-function

0.5.1 • Public • Published

serve-function

Serve a function as a REST API.

Usage

The serve-function module has a simple interface:

  var serve = require('serve-function');
 
  function functionToServe (options, callback) {
    var result = options.a + options.b + options.c
    callback(null,result)
  }
 
  var PORT = 9876;
 
  serve({
    port: PORT,
    function: functionToServe
  })
 
  // now use the function with:
  // http://<host>:9876/?a='a'&b='b'&c='c'
 

Run Tests

  $ npm test

Readme

Keywords

Package Sidebar

Install

npm i serve-function

Weekly Downloads

0

Version

0.5.1

License

MIT

Last publish

Collaborators

  • bagrounds