0.3.2 • Published 6 years ago

@orikami/fn-to-json-api v0.3.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

fn-to-json-api

Transform business logic (data => {}) to a micro server handler ((req,res) => {})

data will be the JSON POST body and GET query parameters.

Install

npm install --save @orikami/fn-to-json-api

Usage

Given some business logic in index.js:

module.exports = (data, req, res) => { return data; }

Convert it to a micro server handler in handler.js:

var toJsonAPI = require('fn-to-json-api');
var fn = require('./index');

const handler = toJsonAPI(fn);
module.exports = handler;

data will contain the POST data and query parameters. POST will override query parameters.

Changelog

  • 0.3.2 - Update/cleanup dependencies packages
  • 0.3.1 - Return emptry response on OPTIONS request
  • 0.2.0 - Add support for formencoded POST request
  • 0.1.0 - Refactor
  • 0.0.2 - Initial release
0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago