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

midmare-http-router

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midmare-http-router

midmare http router lib

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

npm version Build Status codecov.io

const { createServer } = require('http');
const { default: mid } = require('midmare');
const { Router: { HttpRouter, delegateHttp } } = require('midmare-http-router');

// HTTP ROUTER
const app = mid();
const httpRouter = new HttpRouter();

// Use named function declaration to 
httpRouter.process('/', function get(ctx) {
    ctx.status = 200;
    ctx.body = { ololo:1 };
});
app.use(httpRouter).init();

// Be sure that you use `delegateHttp` on app.
// delegateHttp make app understand that at some moment you will get request response object. And it will be injected to context.
createServer(delegateHttp(app)).listen(3000);

Keywords

http

FAQs

Package last updated on 20 Jul 2020

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