@codeenthusiast09/create-express-app 1.0.1 → 1.0.2
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": "@codeenthusiast09/create-express-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI tool to generate production-ready Express TypeScript projects with flexible database options (MongoDB, PostgreSQL with Prisma or Drizzle)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import pinoHttp from 'pino-http';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { logger } from './logger';
|
|
4
|
+
import '@/types'; // Import to load global type extensions
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* HTTP Request Logger
|
|
8
|
+
*
|
|
9
|
+
* Logs all incoming requests and responses.
|
|
10
|
+
* Use as middleware: app.use(httpLogger)
|
|
11
|
+
*/
|
|
5
12
|
export const httpLogger = pinoHttp({
|
|
6
13
|
logger,
|
|
7
14
|
|
|
15
|
+
// Custom log level based on status code
|
|
8
16
|
customLogLevel: (_req, res, err) => {
|
|
9
17
|
if (res.statusCode >= 500 || err) return 'error';
|
|
10
18
|
if (res.statusCode >= 400) return 'warn';
|
|
11
19
|
return 'info';
|
|
12
20
|
},
|
|
13
21
|
|
|
22
|
+
// Add user info to logs if available
|
|
14
23
|
serializers: {
|
|
15
24
|
req: (req: Request) => ({
|
|
16
25
|
method: req.method,
|