express-genix 1.1.3 → 1.1.5
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/LICENSE +21 -0
- package/README.md +139 -189
- package/lib/generator.js +1 -2
- package/package.json +1 -1
- package/templates/config/database.mongo.js.ejs +2 -4
- package/templates/core/server.js.ejs +10 -5
- package/templates/models/User.mongo.js.ejs +0 -3
- /package/templates/services/{userService.mongo.js.ejs → userService.mongodb.js.ejs} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Joshua Maeba Nyamasege
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,259 +1,209 @@
|
|
|
1
|
-
# Express-Genix
|
|
1
|
+
# Express-Genix
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**NEW**: Now includes a "No Database" option for APIs that don't require database persistence - perfect for microservices, proxy servers, or computational APIs.
|
|
3
|
+
A production-grade CLI tool that generates Express.js applications with a robust, scalable foundation. Get a complete REST API up and running in seconds with authentication, database integration, security, testing, and Docker support.
|
|
6
4
|
|
|
7
5
|
## Features
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
- **
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
7
|
+
**🚀 Three Setup Options**
|
|
8
|
+
- **MongoDB** - Full-stack with Mongoose ORM and JWT authentication
|
|
9
|
+
- **PostgreSQL** - Enterprise-ready with Sequelize ORM and JWT authentication
|
|
10
|
+
- **No Database** - Perfect for microservices, proxy servers, or computational APIs
|
|
11
|
+
|
|
12
|
+
**🔐 Security & Authentication**
|
|
13
|
+
- JWT authentication with refresh tokens (database modes)
|
|
14
|
+
- Helmet security headers
|
|
15
|
+
- CORS configuration
|
|
16
|
+
- Rate limiting out of the box
|
|
17
|
+
- Password hashing with bcrypt
|
|
18
|
+
|
|
19
|
+
**📚 Developer Experience**
|
|
20
|
+
- Swagger/OpenAPI documentation
|
|
21
|
+
- Jest testing with Supertest
|
|
22
|
+
- ESLint (Airbnb) + Prettier pre-configured
|
|
23
|
+
- Auto-formatted code (zero linting errors)
|
|
24
|
+
- Structured logging
|
|
25
|
+
- Health check endpoints
|
|
26
|
+
|
|
27
|
+
**🐳 Production Ready**
|
|
28
|
+
- Docker & Docker Compose included
|
|
29
|
+
- Clustering support for performance
|
|
30
|
+
- Graceful shutdown handling
|
|
31
|
+
- Environment-based configuration
|
|
18
32
|
|
|
19
|
-
##
|
|
33
|
+
## Quick Start
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
### Installation
|
|
22
36
|
|
|
23
37
|
```bash
|
|
24
38
|
npm install -g express-genix
|
|
25
39
|
```
|
|
26
40
|
|
|
27
|
-
|
|
41
|
+
Or use directly with npx (no installation needed):
|
|
28
42
|
|
|
29
43
|
```bash
|
|
30
44
|
npx express-genix init
|
|
31
45
|
```
|
|
32
46
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Run the CLI to generate a new Express project:
|
|
47
|
+
### Create Your Project
|
|
36
48
|
|
|
37
49
|
```bash
|
|
38
50
|
express-genix init
|
|
39
51
|
```
|
|
40
52
|
|
|
41
|
-
|
|
53
|
+
Follow the prompts:
|
|
54
|
+
1. **Project name** - Choose your project name (letters, numbers, hyphens, underscores)
|
|
55
|
+
2. **Database** - Select MongoDB, PostgreSQL, or No Database
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
The CLI will:
|
|
58
|
+
- Generate your project structure
|
|
59
|
+
- Install all dependencies
|
|
60
|
+
- Auto-format and lint the code
|
|
61
|
+
- Set up Docker configuration
|
|
46
62
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
- **Project name**: Enter a name (letters, numbers, hyphens, underscores; default: my-express-app)
|
|
50
|
-
- **Database**: Choose from:
|
|
51
|
-
- **MongoDB (with Mongoose)** - Full authentication system with JWT
|
|
52
|
-
- **PostgreSQL (with Sequelize)** - Full authentication system with JWT
|
|
53
|
-
- **No Database (API without database)** - Example CRUD API with in-memory storage
|
|
54
|
-
|
|
55
|
-
The CLI creates a project directory, generates files, installs dependencies, and **automatically formats and lints the code**.
|
|
56
|
-
|
|
57
|
-
Navigate to the generated project (e.g., `cd my-express-app`) and run:
|
|
63
|
+
### Run Your App
|
|
58
64
|
|
|
59
65
|
```bash
|
|
66
|
+
cd your-project-name
|
|
60
67
|
npm run dev
|
|
61
68
|
```
|
|
62
69
|
|
|
63
|
-
Visit
|
|
70
|
+
Visit:
|
|
71
|
+
- **API Documentation**: http://localhost:3000/api-docs
|
|
72
|
+
- **Health Check**: http://localhost:3000/health
|
|
73
|
+
|
|
74
|
+
## Generated API Endpoints
|
|
64
75
|
|
|
65
|
-
###
|
|
76
|
+
### With Database (MongoDB/PostgreSQL)
|
|
66
77
|
|
|
67
|
-
**
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
- Docker support with clustering
|
|
73
|
-
- Health checks and structured logging
|
|
78
|
+
**Authentication**
|
|
79
|
+
- `POST /api/auth/register` - Register new user
|
|
80
|
+
- `POST /api/auth/login` - User login
|
|
81
|
+
- `POST /api/auth/refresh` - Refresh access token
|
|
82
|
+
- `POST /api/auth/logout` - User logout
|
|
74
83
|
|
|
75
|
-
**
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
84
|
+
**User Management** (Protected)
|
|
85
|
+
- `GET /api/users/profile` - Get user profile
|
|
86
|
+
- `PUT /api/users/profile` - Update user profile
|
|
87
|
+
- `DELETE /api/users/profile` - Delete user account
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
- **Example API**: `/api/examples` (GET, POST, PUT, DELETE) with in-memory storage
|
|
82
|
-
- **Perfect for**: Microservices, proxy servers, computational APIs
|
|
89
|
+
### Without Database
|
|
83
90
|
|
|
84
|
-
|
|
91
|
+
**Example API** (In-memory CRUD)
|
|
92
|
+
- `GET /api/examples` - List all examples (with pagination)
|
|
93
|
+
- `GET /api/examples/:id` - Get example by ID
|
|
94
|
+
- `POST /api/examples` - Create new example
|
|
95
|
+
- `PUT /api/examples/:id` - Update example
|
|
96
|
+
- `DELETE /api/examples/:id` - Delete example
|
|
97
|
+
|
|
98
|
+
## Available Scripts
|
|
85
99
|
|
|
86
100
|
```bash
|
|
87
|
-
|
|
101
|
+
npm run dev # Development server with hot reload
|
|
102
|
+
npm start # Production server with clustering
|
|
103
|
+
npm test # Run tests with coverage
|
|
104
|
+
npm run lint # Check code quality
|
|
105
|
+
npm run lint:fix # Auto-fix linting issues
|
|
106
|
+
npm run format # Format code with Prettier
|
|
107
|
+
npm run format:check # Verify code formatting
|
|
88
108
|
```
|
|
89
109
|
|
|
90
110
|
## Project Structure
|
|
91
111
|
|
|
92
|
-
### CLI Structure
|
|
93
|
-
```
|
|
94
|
-
express-genix/
|
|
95
|
-
├── index.js # Main CLI entry point
|
|
96
|
-
├── package.json # CLI package configuration
|
|
97
|
-
├── README.md # This documentation
|
|
98
|
-
├── lib/
|
|
99
|
-
│ ├── cleanup.js # Post-generation cleanup functions
|
|
100
|
-
│ ├── generator.js # File generation logic
|
|
101
|
-
│ └── utils.js # Utility functions
|
|
102
|
-
└── templates/
|
|
103
|
-
├── core/ # Core files (app.js, server.js, etc.)
|
|
104
|
-
├── config/ # Configuration files
|
|
105
|
-
├── controllers/ # Route handlers
|
|
106
|
-
├── middleware/ # Custom middleware
|
|
107
|
-
├── models/ # Database models
|
|
108
|
-
├── routes/ # API routes
|
|
109
|
-
├── services/ # Business logic
|
|
110
|
-
├── utils/ # Utilities
|
|
111
|
-
└── tests/ # Test files
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Generated Express App Structure
|
|
115
112
|
```
|
|
113
|
+
your-project/
|
|
116
114
|
├── src/
|
|
117
|
-
│ ├── config/
|
|
118
|
-
│ ├── controllers/
|
|
119
|
-
│ ├── middleware/
|
|
120
|
-
│ ├── models/
|
|
121
|
-
│ ├── routes/
|
|
122
|
-
│ ├── services/
|
|
123
|
-
│ ├── utils/
|
|
124
|
-
│ ├── app.js
|
|
125
|
-
│ └── server.js
|
|
126
|
-
├── tests/
|
|
127
|
-
├── .env
|
|
128
|
-
├──
|
|
129
|
-
|
|
130
|
-
├── Dockerfile # Docker configuration
|
|
131
|
-
├── docker-compose.yml # Docker services (app + database)
|
|
132
|
-
└── package.json # Dependencies and scripts
|
|
115
|
+
│ ├── config/ # Database and Swagger config
|
|
116
|
+
│ ├── controllers/ # Request handlers
|
|
117
|
+
│ ├── middleware/ # Auth, validation, errors
|
|
118
|
+
│ ├── models/ # Database models (if enabled)
|
|
119
|
+
│ ├── routes/ # API routes
|
|
120
|
+
│ ├── services/ # Business logic
|
|
121
|
+
│ ├── utils/ # Helper functions
|
|
122
|
+
│ ├── app.js # Express setup
|
|
123
|
+
│ └── server.js # Server entry point
|
|
124
|
+
├── tests/ # Test suites
|
|
125
|
+
├── .env # Environment variables
|
|
126
|
+
├── Dockerfile # Container config
|
|
127
|
+
└── docker-compose.yml # Multi-container setup
|
|
133
128
|
```
|
|
134
129
|
|
|
135
|
-
##
|
|
136
|
-
|
|
137
|
-
- `npm run dev` - Start development server with nodemon
|
|
138
|
-
- `npm start` - Start production server with clustering
|
|
139
|
-
- `npm test` - Run Jest tests with coverage
|
|
140
|
-
- `npm run lint` - Run ESLint checks
|
|
141
|
-
- `npm run lint:fix` - Fix ESLint issues automatically
|
|
142
|
-
- `npm run format` - Format code with Prettier
|
|
143
|
-
- `npm run format:check` - Check code formatting
|
|
130
|
+
## Environment Variables
|
|
144
131
|
|
|
145
|
-
|
|
132
|
+
Create a `.env` file (generated automatically):
|
|
146
133
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
4. **Submit a Pull Request**:
|
|
168
|
-
- Push changes and submit a PR with a clear description
|
|
169
|
-
- Include test results showing the generated project works correctly
|
|
170
|
-
|
|
171
|
-
## Version History
|
|
172
|
-
|
|
173
|
-
- **v1.1.0**: Added "No Database" option and template-based architecture with EJS
|
|
174
|
-
- **v1.0.1**: Added automatic post-generation cleanup with Prettier and ESLint auto-fix
|
|
175
|
-
- **v1.0.0**: Initial release with Express boilerplate generation
|
|
176
|
-
|
|
177
|
-
## Publishing to npm
|
|
178
|
-
|
|
179
|
-
To publish express-genix to npm, follow these steps from the CLI's root directory:
|
|
180
|
-
|
|
181
|
-
### 1. Prepare the Project
|
|
182
|
-
|
|
183
|
-
Ensure all template files are in place in the `templates/` directory structure.
|
|
184
|
-
|
|
185
|
-
Verify `package.json` is configured correctly:
|
|
186
|
-
|
|
187
|
-
```json
|
|
188
|
-
{
|
|
189
|
-
"name": "express-genix",
|
|
190
|
-
"version": "1.1.0",
|
|
191
|
-
"description": "Production-grade CLI to generate Express apps with JWT, DB, rate-limiting, automatic formatting, and more",
|
|
192
|
-
"main": "index.js",
|
|
193
|
-
"bin": {
|
|
194
|
-
"express-genix": "./index.js"
|
|
195
|
-
},
|
|
196
|
-
"dependencies": {
|
|
197
|
-
"commander": "^12.1.0",
|
|
198
|
-
"inquirer": "^10.2.0",
|
|
199
|
-
"ejs": "^3.1.9"
|
|
200
|
-
}
|
|
201
|
-
}
|
|
134
|
+
```bash
|
|
135
|
+
# Server
|
|
136
|
+
NODE_ENV=development
|
|
137
|
+
PORT=3000
|
|
138
|
+
|
|
139
|
+
# Database (if using MongoDB/PostgreSQL)
|
|
140
|
+
MONGO_URI=mongodb://localhost:27017/myapp
|
|
141
|
+
# or
|
|
142
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/myapp
|
|
143
|
+
|
|
144
|
+
# JWT (if using database)
|
|
145
|
+
JWT_SECRET=your-secret-key
|
|
146
|
+
JWT_REFRESH_SECRET=your-refresh-secret
|
|
147
|
+
JWT_EXPIRE=15m
|
|
148
|
+
JWT_REFRESH_EXPIRE=7d
|
|
149
|
+
|
|
150
|
+
# Rate Limiting
|
|
151
|
+
RATE_LIMIT_WINDOW_MS=900000
|
|
152
|
+
RATE_LIMIT_MAX=100
|
|
202
153
|
```
|
|
203
154
|
|
|
204
|
-
|
|
155
|
+
## Docker Deployment
|
|
205
156
|
|
|
206
|
-
|
|
157
|
+
The generated project includes Docker support:
|
|
207
158
|
|
|
208
159
|
```bash
|
|
209
|
-
|
|
210
|
-
|
|
160
|
+
# Build and run with Docker Compose
|
|
161
|
+
docker-compose up
|
|
211
162
|
|
|
212
|
-
|
|
213
|
-
-
|
|
214
|
-
-
|
|
215
|
-
|
|
163
|
+
# Or build manually
|
|
164
|
+
docker build -t my-app .
|
|
165
|
+
docker run -p 3000:3000 --env-file .env my-app
|
|
166
|
+
```
|
|
216
167
|
|
|
217
|
-
|
|
168
|
+
## Troubleshooting
|
|
218
169
|
|
|
219
|
-
|
|
170
|
+
**Database Connection Issues**
|
|
171
|
+
- Ensure MongoDB/PostgreSQL is running
|
|
172
|
+
- Check connection string in `.env`
|
|
173
|
+
- Verify database credentials
|
|
220
174
|
|
|
175
|
+
**Dependency Errors**
|
|
221
176
|
```bash
|
|
222
|
-
npm
|
|
223
|
-
|
|
177
|
+
npm cache clean --force
|
|
178
|
+
rm -rf node_modules package-lock.json
|
|
179
|
+
npm install
|
|
224
180
|
```
|
|
225
181
|
|
|
226
|
-
|
|
182
|
+
**Port Already in Use**
|
|
183
|
+
```bash
|
|
184
|
+
# Change port in .env
|
|
185
|
+
PORT=3001
|
|
186
|
+
```
|
|
227
187
|
|
|
228
|
-
|
|
188
|
+
## CLI Options
|
|
229
189
|
|
|
230
190
|
```bash
|
|
231
|
-
|
|
232
|
-
# Should generate a project with zero linting errors
|
|
191
|
+
express-genix init --skip-cleanup # Skip auto-formatting (for debugging)
|
|
233
192
|
```
|
|
234
193
|
|
|
235
|
-
##
|
|
236
|
-
|
|
237
|
-
### Publishing Issues
|
|
194
|
+
## Contributing
|
|
238
195
|
|
|
239
|
-
|
|
240
|
-
- **Authentication Error**: Verify with `npm whoami`, re-login if needed
|
|
241
|
-
- **Permission Issues**: Move project to a directory with full write access
|
|
196
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
242
197
|
|
|
243
|
-
|
|
198
|
+
## Support
|
|
244
199
|
|
|
245
|
-
- **
|
|
246
|
-
- **
|
|
247
|
-
- **Linting Issues**: Run `npm run lint:fix && npm run format` to resolve formatting
|
|
200
|
+
- **Issues**: [GitHub Issues](https://github.com/yourusername/express-genix/issues)
|
|
201
|
+
- **Documentation**: [Full Docs](https://github.com/yourusername/express-genix)
|
|
248
202
|
|
|
249
203
|
## License
|
|
250
204
|
|
|
251
|
-
MIT
|
|
252
|
-
|
|
253
|
-
Copyright (c) 2025 Joshua Maeba Nyamasege
|
|
254
|
-
|
|
255
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
205
|
+
MIT © [Joshua Maeba Nyamasege](LICENSE)
|
|
256
206
|
|
|
257
|
-
|
|
207
|
+
## Changelog
|
|
258
208
|
|
|
259
|
-
|
|
209
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history and release notes.
|
package/lib/generator.js
CHANGED
|
@@ -126,8 +126,7 @@ const generateFiles = async (config, projectDir) => {
|
|
|
126
126
|
if (config.hasDatabase) {
|
|
127
127
|
serviceFiles.push(
|
|
128
128
|
{ template: 'services/authService.js.ejs', output: 'src/services/authService.js' },
|
|
129
|
-
{ template: `services/userService.${config.db === 'mongodb' ? 'mongodb' : '
|
|
130
|
-
);
|
|
129
|
+
{ template: `services/userService.${config.db === 'mongodb' ? 'mongodb' : 'postgres'}.js.ejs`, output: 'src/services/userService.js' }, );
|
|
131
130
|
} else {
|
|
132
131
|
serviceFiles.push(
|
|
133
132
|
{ template: 'services/exampleService.js.ejs', output: 'src/services/exampleService.js' },
|
package/package.json
CHANGED
|
@@ -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
|