Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@proc/context-koa

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

@proc/context-koa

Adds a @proc/context to koa via a middleware

npmnpm
Version
0.1.32
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

Koa Middleware to provide context.

Get a @proc/context object for every request. While this package works standalone, a more complete web server implementation exists as @proc/runtime.

Usage

import Koa from "koa";
import { createContext } from "@proc/context";
import { middleware, getRequestContext } from "@proc/context-koa";

const app = new Koa();
const parentContext = createContext();
app.use(middleware(parentContext));

app.use((ktx, next) => {
  const childContext = getRequestContext(ktx);
  ktx.body = `Child context had id: ${childContext.id}`;
});

app.listen(8080);

FAQs

Package last updated on 22 Oct 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