New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@orikami/fn-to-json-api

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orikami/fn-to-json-api

Convert (jsonData) => {} to (req, res) => {}

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
3
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 02 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc