express-genix 1.1.1 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,49 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-genix",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Production-grade CLI to generate Express apps with JWT, DB, rate-limiting, automatic formatting, and more",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
|
|
7
|
+
"express-genix": "./index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
"start": "node index.js",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"lint:fix": "eslint . --fix"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"commander": "^12.1.0",
|
|
17
|
+
"inquirer": "^10.2.0",
|
|
18
|
+
"ejs": "^3.1.9"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
"jest": "^29.7.0",
|
|
22
|
+
"eslint": "^8.56.0",
|
|
23
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
24
|
+
"eslint-plugin-import": "^2.29.1"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
"express",
|
|
28
|
+
"cli",
|
|
29
|
+
"boilerplate",
|
|
30
|
+
"jwt",
|
|
31
|
+
"rate-limiting",
|
|
32
|
+
"production",
|
|
33
|
+
"prettier",
|
|
34
|
+
"eslint",
|
|
35
|
+
"mongodb",
|
|
36
|
+
"postgresql",
|
|
37
|
+
"api",
|
|
38
|
+
"nodejs",
|
|
39
|
+
"javascript",
|
|
40
|
+
"backend",
|
|
41
|
+
"rest-api",
|
|
42
|
+
"microservices"
|
|
38
43
|
],
|
|
39
44
|
"author": "Joshua Maeba Nyamasege",
|
|
40
45
|
"license": "MIT",
|
|
41
46
|
"repository": {
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/LambdaAI001/express-genix-CLI.git"
|
|
44
49
|
},
|
|
45
50
|
"bugs": {
|
|
46
|
-
|
|
51
|
+
"url": "https://github.com/LambdaAI001/express-genix-CLI/issues"
|
|
47
52
|
},
|
|
48
|
-
"homepage": "https://github.com/
|
|
49
|
-
|
|
53
|
+
"homepage": "https://github.com/LambdaAI001/express-genix-CLI#readme",
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=16.0.0"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"index.js",
|
|
59
|
+
"lib/",
|
|
60
|
+
"templates/",
|
|
61
|
+
"README.md"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -4,10 +4,8 @@ const mongoUri = process.env.MONGO_URI || 'mongodb://localhost:27017/<%= project
|
|
|
4
4
|
|
|
5
5
|
const connect = async () => {
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
useUnifiedTopology: true,
|
|
10
|
-
});
|
|
7
|
+
// Remove deprecated options - they're no longer needed in modern Mongoose
|
|
8
|
+
await mongoose.connect(mongoUri);
|
|
11
9
|
console.log('MongoDB connected successfully');
|
|
12
10
|
} catch (error) {
|
|
13
11
|
console.error('MongoDB connection error:', error);
|
|
@@ -10,7 +10,8 @@ const startServer = async () => {<% if (hasDatabase) { %>
|
|
|
10
10
|
|
|
11
11
|
if (cluster.isMaster) {
|
|
12
12
|
const numCPUs = os.cpus().length;
|
|
13
|
-
console.log(
|
|
13
|
+
console.log(`🚀 Master ${process.pid} is running`);
|
|
14
|
+
console.log(`📊 Forking ${numCPUs} workers...`);
|
|
14
15
|
|
|
15
16
|
// Fork workers
|
|
16
17
|
for (let i = 0; i < numCPUs; i++) {
|
|
@@ -18,12 +19,16 @@ const startServer = async () => {<% if (hasDatabase) { %>
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
cluster.on('exit', (worker, code, signal) => {
|
|
21
|
-
console.log(
|
|
22
|
+
console.log(`💥 Worker ${worker.process.pid} died with code ${code} and signal ${signal}`);
|
|
23
|
+
console.log('🔄 Starting a new worker...');
|
|
22
24
|
cluster.fork();
|
|
23
25
|
});
|
|
24
26
|
} else {
|
|
25
27
|
app.listen(port, () => {
|
|
26
|
-
console.log(
|
|
28
|
+
console.log(`🌟 Worker ${process.pid} running on http://localhost:${port}`);
|
|
29
|
+
console.log(`📚 API Documentation: http://localhost:${port}/api-docs`);
|
|
30
|
+
console.log(`❤️ Health Check: http://localhost:${port}/health`);
|
|
31
|
+
console.log(`🛠️ Environment: ${process.env.NODE_ENV || 'development'}`);
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
};
|
|
@@ -32,13 +37,13 @@ startServer().catch(console.error);
|
|
|
32
37
|
|
|
33
38
|
// Graceful Shutdown
|
|
34
39
|
process.on('SIGTERM', async () => {
|
|
35
|
-
console.log('SIGTERM signal received: closing HTTP server');<% if (hasDatabase) { %>
|
|
40
|
+
console.log('🛑 SIGTERM signal received: closing HTTP server');<% if (hasDatabase) { %>
|
|
36
41
|
await db.disconnect();<% } %>
|
|
37
42
|
process.exit(0);
|
|
38
43
|
});
|
|
39
44
|
|
|
40
45
|
process.on('SIGINT', async () => {
|
|
41
|
-
console.log('SIGINT signal received: closing HTTP server');<% if (hasDatabase) { %>
|
|
46
|
+
console.log('🛑 SIGINT signal received: closing HTTP server');<% if (hasDatabase) { %>
|
|
42
47
|
await db.disconnect();<% } %>
|
|
43
48
|
process.exit(0);
|
|
44
49
|
});
|
|
File without changes
|