8000 Update to node.js 16, 18, 20, drop 14 support · HowProgrammingWorks/NodeServer@e955bcb · GitHub
[go: up one dir, main page]

Skip to content

Commit e955bcb

Browse files
committed
Update to node.js 16, 18, 20, drop 14 support
1 parent b85a3a8 commit e955bcb

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"extends": "eslint:recommended",
88
"parserOptions": {
9-
"ecmaVersion": 2020
9+
"ecmaVersion": "latest"
1010
},
1111
"globals": {
1212
"BigInt": true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2022 How.Programming.Works contributors
3+
Copyright (c) 2017-2023 How.Programming.Works contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

express-cluster/server.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ const app = express();
77

88
const user = { name: 'jura', age: 22 };
99

10-
if (cluster.isMaster) {
11-
10+
if (cluster.isPrimary) {
1211
const count = os.cpus().length;
1312
for (let i = 0; i < count; i++) cluster.fork();
14-
1513
} else {
16-
1714
app.get('/', (req, res) => {
1815
res.end('welcome to homepage');
1916
});
@@ -31,5 +28,4 @@ if (cluster.isMaster) {
3128
});
3229

3330
app.listen(8000);
34-
3531
}

ip-sticky/server.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const http = require('node:http');
66
const cluster = require('node:cluster');
77
const cpus = os.cpus().length;
88

9-
if (cluster.isMaster) {
10-
9+
if (cluster.isPrimary) {
1110
console.log(`Master pid: ${process.pid}`);
1211
console.log(`Starting ${cpus} forks`);
1312

@@ -30,9 +29,7 @@ if (cluster.isMaster) {
3029

3130
const server = new net.Server(balancer);
3231
server.listen(2000);
33-
3432
} else {
35-
3633
console.log(`Worker pid: ${process.pid}`);
3734

3835
const dispatcher = (req, res) => {
@@ -50,5 +47,4 @@ if (cluster.isMaster) {
5047
server.emit('connection', socket);
5148
}
5249
});
53-
5450
}

native-cluster/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const types = {
2424
function: (fn, par, client) => JSON.stringify(fn(client, par)),
2525
};
2626

27-
if (cluster.isMaster) {
27+
if (cluster.isPrimary) {
2828
const count = os.cpus().length;
2929
console.log(`Master pid: ${pid}`);
3030
console.log(`Starting ${count} forks`);

0 commit comments

Comments
 (0)
0