Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.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

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
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 08 Jan 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