Skip to content

Commit

Permalink
docs: fix service path (#463)
Browse files Browse the repository at this point in the history
Co-authored-by: songjiachao <songjiachao@vivo.com>
  • Loading branch information
super918180 and songjiachao authored Apr 9, 2020
1 parent 18b1b7e commit cf12640
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions docs/en/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The structure of Midway is similar to Eggjs, but there are still differences:

* TypeScript code is located in `src/`, and built out `dist/`.
* The original `app/` is moved to `src/app/`.
* It is suggested that write your business logic to the `lib/`, such as `lib/service`.
* It is suggested that write your business logic to other directories, such as `/service`.

```plain
➜ midway6-test tree -I node_modules
Expand Down Expand Up @@ -83,9 +83,8 @@ The structure of Midway is similar to Eggjs, but there are still differences:
│   │   ├── config.prod.ts
│   │   ├── config.unittest.ts
│   │   └── plugin.ts
│   └── lib ---- business logics (user define)
│   └── service ---- business logics (user define)
│   │   └── service ---- services (user define)
│   │       └── user.ts
│   ├── interface.ts ---- interface definition (user define)
│   ├── app.ts (opt) ---- application extend file
│   └── agent.ts (opt) ---- agent extend file
Expand Down Expand Up @@ -757,7 +756,7 @@ describe('test/controller/home.test.ts', () => {

Cause Midway suggest use IoC way to write service, so it's coding and testing have obvious difference with Eggjs.

Such as `src/lib/service/user.ts`:
Such as `src/service/user.ts`:

```typescript
import { provide } from 'midway';
Expand Down
9 changes: 4 additions & 5 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ midway 的目录和 eggjs 目录非常接近,但也有所区别,不同的地

* ts 源码存放于 `/src` 目录下,编译后代码存放于 `/dist`
* 以往的 app 等都迁移至 `/src/app` 下,作为 web 层
* 传统的业务逻辑等,移动到其他目录,比如 `lib/service`
* 传统的业务逻辑等,移动到其他目录,比如 `/service`

```plain
➜ midway6-test tree -I node_modules
Expand Down Expand Up @@ -85,9 +85,8 @@ midway 的目录和 eggjs 目录非常接近,但也有所区别,不同的地
│   │   ├── config.prod.ts
│   │   ├── config.unittest.ts
│   │   └── plugin.ts
│   └── lib ---- 业务逻辑层目录,自由定义
│   │   └── service ---- 业务逻辑层,自由定义
│   │       └── user.ts
│   └── service ---- 业务逻辑层目录,自由定义
│   │   └── user.ts ---- 业务逻辑层,自由定义
│   ├── interface.ts ---- 接口定义文件,自由定义
│   ├── app.ts ---- 应用扩展文件,可选
│   └── agent.ts ---- agent 扩展文件,可选
Expand Down Expand Up @@ -778,7 +777,7 @@ describe('test/controller/home.test.ts', () => {

由于 midway 提倡使用 IoC 的方式来定义 service,所以编码与测试都与 eggjs 有明显的区别。

例如 `src/lib/service/user.ts`:
例如 `src/service/user.ts`:

```typescript
import { provide } from 'midway';
Expand Down

0 comments on commit cf12640

Please sign in to comment.