egg-typed
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

egg-typed

NPM version build status Test coverage David deps Known Vulnerabilities

An onther style (like C#/java) of egg enterprise app framework.

Quick overview

路由

egg-controller

export class HomeController extends Controller {
  // 如果不需要访问ctx,则不需要继承
  @route("/api/xxx", { name: "获取XXX数据" })
  async getXXX(size: number, page: number) {
    return "homeIndex";
  }
}

依赖注入

egg-aop

export class TestService extends Service {
  get(id: string | number) {
    return {
      id,
      name: this.app.config.test + "_" + id
    };
  }
}
 
export class HomeController extends Controller {
  @lazyInject()
  testService: TestService;
 
  @route("/api/xxx", { name: "获取XXX数据" })
  async getXXX(id: string) {
    return this.testService.get(id);
  }
}

ORM

调用链跟踪

场景测试

使用 & 配置方法

  1. use egg-init to initialize a project.

  2. config project.json add:

  "egg"{
    "framework": "egg-typed"
  },
  1. An example of tsconfig.json:
{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "preserveConstEnums": true,
    "declaration": true,
    "sourceMap": true,
    "rootDir": "src",
    "outDir": "app",
    "pretty": true
  }
}

Questions & Suggestions

Please open an issue here.

Readme

Keywords

Package Sidebar

Install

npm i egg-typed

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

102 kB

Total Files

93

Last publish

Collaborators

  • zhang740