@ccci/micro-server 1.0.12 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -98456,7 +98456,7 @@ var require_dist4 = __commonJS((exports, module) => {
98456
98456
  // src/utils/ApplicationServer.ts
98457
98457
  var import_express = __toESM(require_express2(), 1);
98458
98458
  var import_cors = __toESM(require_lib3(), 1);
98459
- import path3 from "path";
98459
+ import path2 from "path";
98460
98460
 
98461
98461
  // node_modules/helmet/index.mjs
98462
98462
  var normalizeDirectives = function(options) {
@@ -99226,26 +99226,13 @@ var dist = __toESM(require_dist4(), 1);
99226
99226
  var { Server, Namespace, Socket } = dist.default;
99227
99227
 
99228
99228
  // src/utils/WebsocketServer.ts
99229
- import fs3 from "fs";
99230
- import path2 from "path";
99231
-
99232
99229
  class WebSocketServer {
99233
99230
  static io;
99234
99231
  constructor(app, folderName = "sockets") {
99235
99232
  WebSocketServer.io = new Server(app);
99236
99233
  WebSocketServer.io.on("connection", (socket) => {
99237
- console.log("connected :>> ", socket);
99238
- fs3.readdirSync(folderName).forEach((file) => {
99239
- let fullName = path2.join(folderName, file);
99240
- if (file.toLowerCase().indexOf(".js") || file.toLowerCase().indexOf(".ts")) {
99241
- let socketName = file.replace(".js", "").replace(".ts", "").split("\\").join("/");
99242
- console.log("socketClass :>> ", fullName);
99243
- import(fullName).then((socketClass) => {
99244
- let instance = new socketClass.default(socket);
99245
- console.log("socketInstance :>> ", instance);
99246
- });
99247
- }
99248
- });
99234
+ Logger.info(`connected :>> ${JSON.stringify(socket)}`);
99235
+ socket.emit("connected...");
99249
99236
  });
99250
99237
  }
99251
99238
  }
@@ -99266,7 +99253,7 @@ class ApplicationServer {
99266
99253
  await db.connect(conn[0]);
99267
99254
  await db.initializeModels();
99268
99255
  ApplicationServer.app.get("/", (req, resp) => {
99269
- return resp.sendFile(path3.resolve("index.html"));
99256
+ return resp.sendFile(path2.resolve("index.html"));
99270
99257
  });
99271
99258
  Logger.info("Create API Routes...\n");
99272
99259
  new RouterFactory(ApplicationServer.app, process.cwd(), "routes");
@@ -99277,7 +99264,7 @@ class ApplicationServer {
99277
99264
  if (options?.enableWebSocket) {
99278
99265
  Logger.info("enabling websocket :>>");
99279
99266
  let weboscket = new WebSocketServer(server);
99280
- Logger.info(`enabling websocket :>> ${weboscket}}`);
99267
+ Logger.info(`enabling websocket :>> ${JSON.stringify(weboscket)}}`);
99281
99268
  }
99282
99269
  }
99283
99270
  getInstance() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",