New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

httple

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httple

The simple and minimal http wrapper for microservice

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

httple

MIT License npm version

The simple and minimal http wrapper for microservice

Usage

const httple = require("httple")

httple(
  [HTTP method name]: string,
  [port number]: number,
  [regexp of endpoint]: RegExp,
  [validation json object]: { [key: string]: (val) => boolean; },
  [server behavir function]: (req, res, json: object) => void,
  [server created callback function]: () => void
)

Sample code

JSON receive server

const httple = require("httple")

httple("POST", 3000, /^\/$/, {
  a: (v) => { return v.length > 0; },
  b: (v) => { return v.length > 1; },
  c: (v) => { return v.length > 3; },
}, (req, res, json) => {
  console.log(json);
  res.writeHead(200, "Success");
  res.end();
}, () => {
  console.log("server start");
})

Simple GET server

const httple = require("httple")

httple("GET", 3000, /^\/$/, null, (req, res) => {
  res.writeHead(200, "Success");
  res.end();
}, () => {
  console.log("server start");
})

Exec in Docker container

redshoga/httple-docker-sample: Sample docker container for simple http module

TODO

  • Add test

Keywords

http

FAQs

Package last updated on 26 Apr 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