Skip to content

Commit

Permalink
docs(types): usage of Middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Jul 9, 2019
1 parent c4f1eab commit 38fc9c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/en/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Sometimes we have the need to load middleware on a specific route. In previous v
Now you can provide a middleware in you application (any directory),such as `src/app/middleware/api.ts`.

```ts
import { WebMiddleware } from 'midway';
import { Middleware, WebMiddleware, provide } from 'midway';

@provide()
export class ApiMiddleware implements WebMiddleware {
Expand All @@ -316,7 +316,7 @@ export class ApiMiddleware implements WebMiddleware {
helloConfig;

resolve() {
return async (ctx, next) => {
return async (ctx, next): Middleware => {
ctx.api = '222' + this.helloConfig.b;
await next();
};
Expand Down
4 changes: 2 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class HomeController {
现在可以提供一个 middleware(任意目录),比如 `src/app/middleware/api.ts`

```ts
import { WebMiddleware } from 'midway';
import { Middleware, WebMiddleware, provide } from 'midway';

@provide()
export class ApiMiddleware implements WebMiddleware {
Expand All @@ -326,7 +326,7 @@ export class ApiMiddleware implements WebMiddleware {
helloConfig;

resolve() {
return async (ctx, next) => {
return async (ctx, next): Middleware => {
ctx.api = '222' + this.helloConfig.b;
await next();
};
Expand Down

0 comments on commit 38fc9c7

Please sign in to comment.