Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extends:
- 'plugin:@typescript-eslint/recommended-requiring-type-checking'
- 'plugin:jest/recommended'
- 'prettier'
- 'prettier/@typescript-eslint'
rules:
'@typescript-eslint/explicit-member-accessibility': off
'@typescript-eslint/no-angle-bracket-type-assertion': off
Expand All @@ -32,3 +31,5 @@ rules:
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/explicit-module-boundary-types': off
'@typescript-eslint/no-unsafe-argument': off
'@typescript-eslint/no-var-requires': off
32 changes: 17 additions & 15 deletions docs/lang/chinese/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
并确认在使用 routing-controllers 前引入

```typescript

```

3. 安装框架:
Expand Down Expand Up @@ -944,23 +945,24 @@ app.listen(3000);

第二种,声明一个类:

```typescript
import { KoaMiddlewareInterface } from 'routing-controllers';

```typescript
import { KoaMiddlewareInterface } from "routing-controllers";

export class MyMiddleware implements KoaMiddlewareInterface { // 接口声明可选

use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
console.log("do something before execution...");
return next().then(() => {
console.log("do something after execution");
}).catch(error => {
console.log("error handling is also here");
});
}
export class MyMiddleware implements KoaMiddlewareInterface {
// 接口声明可选

}
```
use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
console.log('do something before execution...');
return next()
.then(() => {
console.log('do something after execution');
})
.catch(error => {
console.log('error handling is also here');
});
}
}
```

2. 应用:

Expand Down
14 changes: 8 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverageFrom: ['src/**/*.ts', '!src/**/index.ts', '!src/**/*.interface.ts'],
globals: {
'ts-jest': {
tsConfig: 'tsconfig.spec.json',
},
},
setupFilesAfterEnv: ["./jest.setup.js"]
globals: {},
setupFilesAfterEnv: ["./jest.setup.js"],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{tsconfig: './tsconfig.spec.json'},
],
}
};
31 changes: 16 additions & 15 deletions lang/chinese/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -952,23 +952,24 @@ app.listen(3000);

第二种,声明一个类:

```typescript
import { KoaMiddlewareInterface } from 'routing-controllers';

```typescript
import { KoaMiddlewareInterface } from "routing-controllers";

export class MyMiddleware implements KoaMiddlewareInterface { // 接口声明可选

use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
console.log("do something before execution...");
return next().then(() => {
console.log("do something after execution");
}).catch(error => {
console.log("error handling is also here");
});
}
export class MyMiddleware implements KoaMiddlewareInterface {
// 接口声明可选

}
```
use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
console.log('do something before execution...');
return next()
.then(() => {
console.log('do something after execution');
})
.catch(error => {
console.log('error handling is also here');
});
}
}
```

2. 应用:

Expand Down
Loading