@typeservice/koa
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@typeservice/koa

codecov

It is a KOA-based service architecture that is fully compatible with all KOA ecosystems, while providing dynamic Agent assistance processes and IPC communication mechanisms.

Installing

For the latest stable version:

$ npm install @typeservice/koa

Usage

import Koa, { Context } from '@typeservice/koa';
interface CustomContext extends Context {
  abc: number
}
const app = new Koa<any, CustomContext>(9000);
app.use(async (ctx, next) => {
  ctx.abc = 789;
  await next();
});
app.use(async (ctx, next) => {
  ctx.body = 'hello world, ' + ctx.abc;
  await next();
});
app.httpBootstrap();
app.listen();

You also can user messager

const app = new Koa(9000);
app.use(async (ctx, next) => {
  ctx.abc = await ctx.messager.invoke('xxxx', 'xxxx', 'xxxx');
  await next();
});
app.httpBootstrap();
app.listen();

License

MIT

Copyright (c) 2019-present, yunjie (Evio) shen

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.50latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @typeservice/koa

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

5.63 kB

Total Files

4

Last publish

Collaborators

  • evio