Installation
npm i egg-koid
Configuration
Enable Plugin
Edit ${app_root}/src/config/plugin.ts
:
export const koid = {
enable: true,
package: 'egg-koid',
}
Add Configurations
import { KoidEggConfig, genConfigRandom } from 'egg-koid'
export const koid: KoidEggConfig = {
client: {
debug: false,
koidConfig: genConfigRandom(),
},
}
export const koid: KoidEggConfig = {
client: {
debug: false,
koidConfig: {
dataCenter: 0,
worker: 1,
}
},
}
Usage
import { Plugin, Provide } from '@midwayjs/decorator'
import type { Koid } from 'egg-koid'
@Provide()
export class UserService {
@Plugin() readonly koid: Koid
}
License
MIT
Languages