Skip to content

Commit f7ffb93

Browse files
authored
Refactor to use native Node.js modules, support Node.js v20+ and modernize the code (#180)
* refactor: upgrade deps + refactor code to be with oop class style + support node.js 20+ ...etc * fix: add fix for #179 issue
1 parent 31deae8 commit f7ffb93

File tree

10 files changed

+2711
-3090
lines changed

10 files changed

+2711
-3090
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ jobs:
1010
os:
1111
- ubuntu-latest
1212
node_version:
13-
- 14
14-
- 16
15-
- 18
13+
- 20
14+
- 22
1615
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
1716
steps:
1817
- uses: actions/checkout@v3

.xo-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module.exports = {
3232
'unicorn/explicit-length-check': 'warn',
3333
'unicorn/no-array-reduce': 'warn',
3434
'unicorn/prefer-spread': 'warn',
35-
'unicorn/prefer-node-protocol': 'off'
35+
'unicorn/prefer-node-protocol': 'off',
36+
'unicorn/expiring-todo-comments': 'off',
37+
'max-nested-callbacks': 'off'
3638
}
3739
};

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ See [API Reference](./API.md) for more documentation.
6969
| ---------------- |
7070
| **Alex Mingoia** |
7171
| **@koajs** |
72+
| **Imed Jaberi** |
7273

7374

7475
## License

bench/server.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
const Koa = require('koa');
2-
const Router = require('../');
1+
const process = require('node:process');
32
const env = require('@ladjs/env')({
43
path: '../.env',
54
includeProcessEnv: true,
65
assignToProcessEnv: true
76
});
7+
const Koa = require('koa');
8+
9+
const Router = require('../');
810

911
const app = new Koa();
1012
const router = new Router();
1113

12-
const ok = (ctx) => (ctx.status = 200);
14+
const ok = (ctx) => {
15+
ctx.status = 200;
16+
};
17+
1318
const n = Number.parseInt(env.FACTOR || '10', 10);
1419
const useMiddleware = env.USE_MIDDLEWARE === 'true';
1520

0 commit comments

Comments
 (0)