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

1.2.1 • 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

/@midwayjs/egg/

    Package Sidebar

    Install

    npm i @midwayjs/egg

    Weekly Downloads

    0

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    13

    Last publish

    Collaborators

    • mariodu
    • czy88840616
    • legendecas
    • echosoar
    • lellansin
    • lxxyx
    • stone-jin