@midwayjs-component/egg
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

midway component for egg

Install

npm i @midwayjs-component/egg --save

Usage

add egg plugin in plugin.ts or other env.

// plugin.ts
export default {
  mysql: {
    enable: true,
    package: 'egg-mysql'
  }
},
// config.default.ts
{
  mysql: {
    //... other config for mysql plugin
  }
}

In Code, you can use plugin like midway.

export class IndexHandler implements FunctionHandler {
  @Inject()
  ctx: FaaSContext;

  @Plugin()
  mysql;

  @Func('index.handler')
  async handler() {
    // this.mysql.xxxx
    // or this.ctx.xxxx
  }
}

Some differences

  • No agent worker and IPC Messager
  • Does not support stream related plugins
  • Will not load the current directory as a plugin

Readme

Keywords

none

Package Sidebar

Install

npm i @midwayjs-component/egg

Weekly Downloads

1

Version

1.0.8

License

MIT

Unpacked Size

181 kB

Total Files

14

Last publish

Collaborators

  • czy88840616