opticore-webapp 1.0.1 → 1.0.3

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": "opticore-webapp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "wep server",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,7 +32,7 @@
32
32
  "express-session": "^1.0.0",
33
33
  "express-useragent": "^1.0.15",
34
34
  "gradient-string": "^2.0.2",
35
- "opticore-logger": "^1.0.1",
35
+ "opticore-logger": "^1.0.4",
36
36
  "opticore-router": "^1.0.7",
37
37
  "opticore-validator": "^1.0.3",
38
38
  "typescript": "^5.4.5"
@@ -8,104 +8,84 @@ import {LogMessageUtils} from "@webApp/core/utils/logMessage.utils";
8
8
  import {dateTimeFormattedUtils as currentDate} from "@webApp/core/utils/dateTimeFormatted.utils";
9
9
  import {messageException as msg} from "@webApp/application/exceptions/messages.exception";
10
10
  import {CEventNameError as eventName} from "@webApp/domains/constants/eventNameError.constant";
11
+ import {LoggerCore} from "opticore-logger";
11
12
 
12
13
 
13
14
  export class ServerListenEventError {
15
+ private static logger: LoggerCore = new LoggerCore();
16
+ private static stackTrace: StackTraceError;
17
+
18
+ /**
19
+ *
20
+ */
14
21
  static hostPortUndefined(): void {
15
- const stackTrace: StackTraceError = this.traceError(msg.errorHostUrl, msg.listening, status.BAD_REQUEST);
16
- LogMessageUtils.error(
17
- msg.webServer,
18
- msg.badHost,
19
- stackTrace.stack!,
20
- msg.errorHostUrl,
21
- status.BAD_REQUEST
22
- );
22
+ this.stackTrace = this.traceError(msg.errorHostUrl, msg.listening, status.BAD_REQUEST);
23
+ this.logger.error(this.stackTrace.message, msg.webServer, msg.badHost, this.stackTrace.stack, status.BAD_REQUEST);
23
24
  process.exit();
24
25
  }
26
+
27
+ /**
28
+ *
29
+ */
25
30
  static hostUndefined(): void {
26
- const stackTrace: StackTraceError = this.traceError(msg.badHost, msg.listening, status.BAD_REQUEST);
27
- LogMessageUtils.error(
28
- msg.webServer,
29
- msg.badHost,
30
- stackTrace.stack!,
31
- msg.errorHost,
32
- status.BAD_REQUEST
33
- );
31
+ this.stackTrace = this.traceError(msg.badHost, msg.listening, status.BAD_REQUEST);
32
+ this.logger.error(this.stackTrace.message, msg.webServer, msg.badHost, this.stackTrace.stack, status.BAD_REQUEST);
34
33
  process.exit();
35
34
  }
35
+
36
+ /**
37
+ *
38
+ */
36
39
  static portUndefined(): void {
37
- const stackTrace: StackTraceError = this.traceError(msg.badPort, msg.listening, status.BAD_REQUEST);
38
- LogMessageUtils.error(
39
- msg.webServer,
40
- msg.badPort,
41
- stackTrace.stack!,
42
- msg.errorPort,
43
- status.BAD_REQUEST
44
- );
40
+ this.stackTrace = this.traceError(msg.badPort, msg.listening, status.BAD_REQUEST);
41
+ this.logger.error(this.stackTrace.message, msg.webServer, msg.badHost, this.stackTrace.stack, status.BAD_REQUEST);
45
42
  process.exit();
46
43
  }
44
+
45
+ /**
46
+ *
47
+ * @param err
48
+ */
47
49
  static onEventError(err: Error): void {
48
- LogMessageUtils.error(
49
- "Server start error",
50
- "Error",
51
- err.stack,
52
- err.message,
53
- status.SERVICE_UNAVAILABLE
54
- );
50
+ this.logger.error(err.message, "Server start error", "Error", err.stack, status.SERVICE_UNAVAILABLE);
55
51
  }
56
- static listenerError(error: Error): void {
57
- const stackTrace: StackTraceError = this.traceError(
58
- error.message,
59
- error.name,
60
- status.BAD_REQUEST
61
- );
62
52
 
63
- LogMessageUtils.error(
64
- "Event error",
65
- "Error",
66
- error.stack!,
67
- stackTrace.message,
68
- status.SERVICE_UNAVAILABLE
69
- );
53
+ /**
54
+ *
55
+ * @param error
56
+ */
57
+ static listenerError(error: Error): void {
58
+ this.stackTrace = this.traceError(error.message, error.name, status.BAD_REQUEST);
59
+ this.logger.error(this.stackTrace.message, "Event error", "Error", error.stack, status.BAD_REQUEST);
70
60
  }
61
+
62
+ /**
63
+ *
64
+ * @param code
65
+ */
71
66
  static processBeforeExit(code: number): void {
72
- const stackTrace: StackTraceError = this.traceError(
73
- `Process will exit with code: ${code}`,
74
- "BeforeExit",
75
- status.SERVICE_UNAVAILABLE
76
- );
77
- LogMessageUtils.error(
78
- "BeforeExit",
79
- "process before exit",
80
- stackTrace.stack,
81
- `Process will exit with code: ${code}`,
82
- status.SERVICE_UNAVAILABLE
83
- );
67
+ this.stackTrace = this.traceError(`Process will exit with code: ${code}`, "BeforeExit", status.SERVICE_UNAVAILABLE);
68
+ this.logger.error(this.stackTrace.message, "BeforeExit", "process before exit", this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
84
69
  process.exit(code);
85
70
  }
71
+
72
+ /**
73
+ *
74
+ */
86
75
  static processDisconnected(): void {
87
- const stackTrace: StackTraceError = this.traceError(
88
- "Child process disconnected",
89
- "process disconnected",
90
- status.SERVICE_UNAVAILABLE
91
- );
92
- LogMessageUtils.error(
93
- "Disconnected",
94
- "process disconnected",
95
- stackTrace.stack,
96
- "Child process disconnected",
97
- status.SERVICE_UNAVAILABLE
98
- );
76
+ this.stackTrace = this.traceError("Child process disconnected", "process disconnected", status.SERVICE_UNAVAILABLE);
77
+ this.logger.error(this.stackTrace.message, "Disconnected", "process disconnected", this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
99
78
  process.exit();
100
79
  }
80
+
81
+ /**
82
+ *
83
+ * @param code
84
+ */
101
85
  static exited(code: number){
102
86
  switch (code) {
103
87
  case 0:
104
- LogMessageUtils.success(
105
- "Exited",
106
- "completed",
107
- "The process finished as expected and everything is ok"
108
- );
88
+ this.logger.success("completed", "The process finished as expected and everything is ok");
109
89
  console.log("");
110
90
  const paddingLength: number = 35;
111
91
  const msg0: string = ' '.padEnd(paddingLength, ' ');
@@ -114,281 +94,221 @@ export class ServerListenEventError {
114
94
  console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, ' ')));
115
95
  break;
116
96
  case 1:
117
- const gnleStackTrace: StackTraceError = this.traceError(
118
- "Something went wrong",
119
- "General Errors",
120
- status.SERVICE_UNAVAILABLE
121
- );
122
- LogMessageUtils.error(
123
- "Exited",
124
- "General Errors",
125
- gnleStackTrace.stack,
126
- "Something went wrong",
127
- status.SERVICE_UNAVAILABLE
128
- );
97
+ this.stackTrace = this.traceError("Something went wrong", "General Errors", status.SERVICE_UNAVAILABLE);
98
+ this.logger.error(this.stackTrace.message, "Exited", "General Errors", this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
129
99
  break
130
100
  case 2:
131
- const incrCmdStackTrace: StackTraceError = this.traceError(
132
- "Incorrect using of shell commands",
133
- "Misuse of shell builtins",
134
- status.SERVICE_UNAVAILABLE
135
- );
136
- LogMessageUtils.error(
137
- "Exited",
138
- incrCmdStackTrace.name,
139
- incrCmdStackTrace.stack,
140
- "Incorrect using of shell commands",
141
- status.SERVICE_UNAVAILABLE
142
- );
101
+ this.stackTrace = this.traceError("Incorrect using of shell commands", "Misuse of shell builtins", status.SERVICE_UNAVAILABLE);
102
+ this.logger.error(this.stackTrace.message, "Exited", "Incorrect using of shell commands", this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
143
103
  break;
144
104
  case 126:
145
- const notExeCmdStackTrace: StackTraceError = this.traceError(
105
+ this.stackTrace = this.traceError(
146
106
  "Incorrect using of shell commands",
147
- "Misuse of shell builtins",
148
- status.SERVICE_UNAVAILABLE
149
- );
150
- LogMessageUtils.error(
151
- "Exited",
152
- `command invoked`,
153
- notExeCmdStackTrace.stack,
154
107
  "The command is found but is not executable (e.g., trying to execute a directory)",
155
108
  status.SERVICE_UNAVAILABLE
156
109
  );
110
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
157
111
  break
158
112
  case 127:
159
- const cmdNotFoundStackTrace: StackTraceError = this.traceError(
160
- "The command was not found in the system's PATH or is misspelled",
161
- "Exited",
162
- status.SERVICE_UNAVAILABLE
163
- );
164
- LogMessageUtils.error(
165
- "Exited",
113
+ this.stackTrace = this.traceError(
166
114
  "Command not found",
167
- cmdNotFoundStackTrace.stack,
168
115
  "The command was not found in the system's PATH or is misspelled",
169
116
  status.SERVICE_UNAVAILABLE
170
117
  );
118
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
171
119
  break;
172
120
  case 128:
173
- const cmdSysNotFoundStackTrace: StackTraceError = this.traceError(
121
+ this.stackTrace = this.traceError(
174
122
  "The command was not found in the system's PATH or is misspelled",
175
- "Exited",
176
- status.SERVICE_UNAVAILABLE
177
- );
178
- LogMessageUtils.error(
179
- "Exited",
180
123
  "Invalid argument",
181
- cmdSysNotFoundStackTrace.stack,
182
- "The command was not found in the system's PATH or is misspelled",
183
124
  status.SERVICE_UNAVAILABLE
184
125
  );
126
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
185
127
  break;
186
128
  case 130:
187
- const endScriptStackTrace: StackTraceError = this.traceError(
129
+ this.stackTrace = this.traceError(
188
130
  "Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
189
- "Exited",
190
- status.SERVICE_UNAVAILABLE
191
- );
192
- LogMessageUtils.error(
193
- "Exited",
194
131
  "Script terminated",
195
- endScriptStackTrace.stack,
196
- "Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
197
132
  status.SERVICE_UNAVAILABLE
198
133
  );
134
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
199
135
  break;
200
136
  case 137:
201
- const prcKillStackTrace: StackTraceError = this.traceError(
137
+ this.stackTrace = this.traceError(
202
138
  "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
203
- "Exited",
204
- status.SERVICE_UNAVAILABLE
205
- );
206
- LogMessageUtils.error(
207
- "Exited",
208
139
  "SIGKILL",
209
- prcKillStackTrace.stack,
210
- "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
211
140
  status.SERVICE_UNAVAILABLE
212
141
  );
142
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
213
143
  break;
214
144
  case 139:
215
- const illegalAccessStackTrace: StackTraceError = this.traceError(
145
+ this.stackTrace = this.traceError(
216
146
  "Indicates that the process accessed an illegal memory address (segfault)",
217
- "Exited",
218
- status.SERVICE_UNAVAILABLE
219
- );
220
- LogMessageUtils.error(
221
- "Exited",
222
147
  "Segmentation fault",
223
- illegalAccessStackTrace.stack,
224
- "Indicates that the process accessed an illegal memory address (segfault)",
225
148
  status.SERVICE_UNAVAILABLE
226
149
  );
150
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
227
151
  break;
228
152
  case 143:
229
- const sigtermStackTrace: StackTraceError = this.traceError(
153
+ this.stackTrace = this.traceError(
230
154
  "Indicates that the process received a SIGTERM signal to terminate",
231
- "Exited",
232
- status.SERVICE_UNAVAILABLE
233
- );
234
- LogMessageUtils.error(
235
- "Exited",
236
155
  "process received a SIGTERM",
237
- sigtermStackTrace.stack,
238
- "Indicates that the process received a SIGTERM signal to terminate",
239
156
  status.SERVICE_UNAVAILABLE
240
157
  );
158
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
241
159
  break;
242
160
  case 255:
243
- const outsideStackTrace: StackTraceError = this.traceError(
161
+ this.stackTrace = this.traceError(
244
162
  "An exit code that is outside the allowable range (0-255 for Unix-like systems)",
245
- "Exited",
246
- status.SERVICE_UNAVAILABLE
247
- );
248
- LogMessageUtils.error(
249
- "Exited",
250
163
  "out of range",
251
- outsideStackTrace.stack,
252
- "An exit code that is outside the allowable range (0-255 for Unix-like systems)",
253
164
  status.SERVICE_UNAVAILABLE
254
165
  );
166
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
255
167
  break;
256
168
  default:
257
- const globalStackTrace: StackTraceError = this.traceError(
169
+ this.stackTrace = this.traceError(
258
170
  "Error is occurring",
259
- "Exited",
260
- status.SERVICE_UNAVAILABLE
261
- );
262
- LogMessageUtils.error(
263
- "Exited",
264
171
  "errors",
265
- globalStackTrace.stack,
266
- "Error is occurring",
267
172
  status.SERVICE_UNAVAILABLE
268
173
  );
174
+ this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
269
175
  break;
270
176
  }
271
177
  }
178
+
179
+ /**
180
+ *
181
+ * @param promise
182
+ */
272
183
  static promiseRejectionHandled(promise: Promise<any>): void {
273
- const globalStackTrace: StackTraceError = this.traceError(
184
+ this.stackTrace = this.traceError(
274
185
  `Promise rejection is handled at : ${promise}`,
275
186
  "rejection promise",
276
187
  status.SERVICE_UNAVAILABLE
277
188
  );
278
- LogMessageUtils.error(
279
- "PromiseRejectionHandled",
280
- "rejection promise",
281
- globalStackTrace.stack,
282
- `Promise rejection is handled at : ${promise}`,
283
- status.SERVICE_UNAVAILABLE
284
- );
189
+ this.logger.error(this.stackTrace.message, "PromiseRejectionHandled", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
285
190
  }
191
+
192
+ /**
193
+ *
194
+ * @param error
195
+ */
286
196
  static uncaughtException(error: any): void {
287
197
  if (error.message === '\'app.router\' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.') {
288
198
  console.log("");
289
199
  } else {
290
- const tackTrace: StackTraceError = this.traceError(
291
- error.message,
292
- "uncaught exception handled",
293
- status.SERVICE_UNAVAILABLE
294
- );
295
- LogMessageUtils.error(
296
- "UncaughtException",
297
- "uncaught exception handled",
298
- tackTrace.stack,
299
- error.message,
300
- status.SERVICE_UNAVAILABLE
301
- );
200
+ this.stackTrace = this.traceError(error.message, "uncaught exception handled", status.SERVICE_UNAVAILABLE);
201
+ this.logger.error(this.stackTrace.message, "UncaughtException", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
302
202
  }
303
203
  }
204
+
205
+ /**
206
+ *
207
+ * @param error
208
+ */
304
209
  static uncaughtExceptionMonitor(error: any): void {
305
210
  if (error.message === '\'app.router\' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.') {
306
211
  console.log("");
307
212
  }
308
213
  }
214
+
215
+ /**
216
+ *
217
+ * @param reason
218
+ * @param promise
219
+ */
309
220
  static unhandledRejection(reason: any, promise: Promise<any>): void{
310
- const stackTrace: StackTraceError = this.traceError(
221
+ this.stackTrace = this.traceError(
311
222
  `Unhandled Rejection at: Promise ${promise} -- reason ${reason}`,
312
223
  "Unhandled rejection",
313
224
  status.SERVICE_UNAVAILABLE
314
225
  );
315
- LogMessageUtils.error(
316
- "UnhandledRejection",
317
- "Unhandled rejection",
318
- stackTrace.stack,
319
- `Unhandled Rejection at: Promise ${promise} -- reason ${reason}`,
320
- status.SERVICE_UNAVAILABLE
321
- );
226
+ this.logger.error(this.stackTrace.message, "UnhandledRejection", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
322
227
  }
228
+
229
+ /**
230
+ *
231
+ * @param warning
232
+ */
323
233
  static warning(warning: any): void {
324
- const stackTrace: StackTraceError = this.traceError(warning.message, "warning", status.SERVICE_UNAVAILABLE);
325
- LogMessageUtils.error(
326
- "Warning",
327
- "warning",
328
- stackTrace.stack,
329
- warning.message,
330
- status.SERVICE_UNAVAILABLE
331
- );
234
+ this.stackTrace = this.traceError(warning.message, "warning", status.SERVICE_UNAVAILABLE);
235
+ this.logger.error(this.stackTrace.message, "Warning", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
332
236
  }
237
+
238
+ /**
239
+ *
240
+ * @param message
241
+ */
333
242
  static message(message: any): void {
334
- const stackTrace: StackTraceError = this.traceError(
243
+ this.stackTrace = this.traceError(
335
244
  `process got message ${message}`,
336
245
  "message exception",
337
246
  status.SERVICE_UNAVAILABLE
338
247
  );
339
- LogMessageUtils.error(
340
- "Message",
341
- "message exception",
342
- stackTrace.stack,
343
- `process got message ${message}`,
344
- status.SERVICE_UNAVAILABLE
345
- );
248
+ this.logger.error(this.stackTrace.message, "Message", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
346
249
  }
250
+
251
+ /**
252
+ *
253
+ * @param type
254
+ * @param promise
255
+ * @param reason
256
+ */
347
257
  static multipleResolves(type: string, promise: Promise<any>, reason: any): void {
348
- const stackTrace: StackTraceError = this.traceError(
258
+ this.stackTrace = this.traceError(
349
259
  `${promise} -- ${reason}`,
350
- "multipleResolves",
351
- status.SERVICE_UNAVAILABLE
352
- );
353
- LogMessageUtils.error(
354
- "multipleResolves",
355
260
  `Multiple resolves detected : ${type}`,
356
- stackTrace.stack,
357
- `${promise} -- ${reason}`,
358
261
  status.SERVICE_UNAVAILABLE
359
262
  );
263
+ this.logger.error(this.stackTrace.message, "multipleResolves", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
360
264
  }
265
+
266
+ /**
267
+ *
268
+ */
361
269
  static processInterrupted(): void {
362
- LogMessageUtils.success(
363
- "[ OK ] Success",
364
- `Process ${process.pid} has been interrupted`,
365
- "The Web server has been stopped !"
366
- );
270
+ this.logger.success("[ OK ] Success", "The Web server has been stopped !")
367
271
  process.exit(0);
368
272
  }
273
+
274
+ /**
275
+ *
276
+ * @param signal
277
+ */
369
278
  static sigtermSignalReceived(signal: any): void {
370
- const stackTrace: StackTraceError = this.traceError(
371
- `Process ${process.pid} received a SIGTERM signal`,
372
- "SIGTERM",
373
- status.NOT_ACCEPTABLE
374
- );
375
- LogMessageUtils.error(
376
- "SIGTERM",
377
- "SIGTERM",
378
- stackTrace.stack,
279
+ this.stackTrace = this.traceError(
379
280
  `Process ${process.pid} received a SIGTERM signal : ${signal.toString()}`,
281
+ "SIGTERM",
380
282
  status.NOT_ACCEPTABLE
381
283
  );
284
+ this.logger.error(this.stackTrace.message, "SIGTERM", this.stackTrace.name, this.stackTrace.stack, status.NOT_ACCEPTABLE);
382
285
  process.exit(0);
383
286
  }
287
+
288
+ /**
289
+ *
290
+ */
384
291
  static serverClosing(): void {
385
292
  console.log(`${colors.bgCyanBright(` ${colors.bold(`${colors.white(` INFO `)}`)}`)} All processes are stopped`);
386
293
  console.log(" Server is closed");
387
294
  process.exit();
388
295
  }
296
+
297
+ /**
298
+ *
299
+ */
389
300
  static dropNewConnection(): void {
390
301
  console.log(`${colors.cyan(`ⓘ`)} ${colors.bgCyan(` ${colors.bold(`${colors.white(` Server maxConnection `)}`)} `)} ${currentDate} | ${colors.bgCyan(`${colors.white(` Info `)}`)} The server dropped new connections`);
391
302
  }
303
+
304
+ /**
305
+ *
306
+ * @param errorEmitter
307
+ * @param err
308
+ * @param req
309
+ * @param res
310
+ * @param next
311
+ */
392
312
  static expressErrorHandlingMiddleware(errorEmitter: any,
393
313
  err: Error,
394
314
  req: express.Request,
@@ -402,14 +322,8 @@ export class ServerListenEventError {
402
322
  console.error('res.status is not a function');
403
323
  }
404
324
 
405
- const stackTrace: StackTraceError = this.traceError(err.message, "Express error", status.NOT_ACCEPTABLE);
406
- LogMessageUtils.error(
407
- "Express error-handling middleware",
408
- "Express error",
409
- stackTrace.stack,
410
- err.message,
411
- status.SERVICE_UNAVAILABLE
412
- )
325
+ this.stackTrace = this.traceError(err.message, "Express error", status.NOT_ACCEPTABLE);
326
+ this.logger.error(this.stackTrace.message, "Express error-handling middleware", this.stackTrace.name, this.stackTrace.stack, status.SERVICE_UNAVAILABLE);
413
327
  } else {
414
328
  next();
415
329
  }
@@ -15,16 +15,13 @@ export function requestCallsEvent(req: IncomingMessage, res: ServerResponse, hos
15
15
  case 200:
16
16
  switch (req.method) {
17
17
  case 'POST': // @ts-ignore
18
- console.log(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`); // @ts-ignore
19
18
  logger.info(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`);
20
19
  break;
21
20
  case 'GET':
22
21
  case 'PUT': // @ts-ignore
23
- console.log(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`); // @ts-ignore
24
22
  logger.info(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`);
25
23
  break;
26
24
  case 'DELETE': // @ts-ignore
27
- console.log(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`);// @ts-ignore
28
25
  logger.info(`[ ${colors.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${colors.bgGreen(`${colors.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${colors.bgCyan(`${colors.white(` 200 `)}`)}`);
29
26
  break;
30
27
  }
package/tsup.config.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import {defineConfig} from "tsup";
2
2
 
3
3
  export default defineConfig({
4
- name: "core-module",
4
+ name: "opticore-webapp",
5
5
  format: ["cjs", "esm"],
6
6
  entry: ['src/index.ts'] ,
7
7
  dts: true,