express-genix 1.1.3 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "express-genix",
3
- "version": "1.1.3",
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": {
@@ -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
- await mongoose.connect(mongoUri, {
8
- useNewUrlParser: true,
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(`Master ${process.pid} is running`);
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(`Worker ${worker.process.pid} died with code ${code} and signal ${signal}`);
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(`Worker ${process.pid} running on http://localhost:${port}`);
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
  });
@@ -26,8 +26,5 @@ const userSchema = new mongoose.Schema({
26
26
  timestamps: true,
27
27
  });
28
28
 
29
- // Index for better query performance
30
- userSchema.index({ email: 1 });
31
- userSchema.index({ username: 1 });
32
29
 
33
30
  module.exports = mongoose.model('User', userSchema);