systemlynx 1.2.0 → 1.4.0

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # SystemLynx ![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg) ![JS 100%](https://img.shields.io/badge/JavaScript-100%25-green)
1
+ # SystemLynx JS ![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg) ![JS 100%](https://img.shields.io/badge/JavaScript-100%25-green)
2
2
 
3
- SystemLynx is a framework for developing modular web APIs. It's a wrapper on top of ExpressJS and Socket.io. With SystemLynx, instead of creating a server with many endpoints, you can simply export objects from the server to the client application. Basically any objects added to a SystemLynx Service can be loaded and used by a SystemLynx Client.
3
+ SystemLynx is a framework for developing modular web APIs in NodeJS. It's a wrapper on top of ExpressJS and Socket.io. With SystemLynx, instead of developing a server with endpoints, you can simply export objects from a server into a client application. Basically any objects hosted by a SystemLynx Service can be loaded and used by a SystemLynx Client.
4
4
 
5
- SystemLynx comes with the following objects that are used for web API development:
5
+ SystemLynx comes with the following objects that are used for web app development:
6
6
 
7
7
  ```javascript
8
8
  const { App, Service, Client, LoadBalancer } = require("systemlynx");
@@ -11,8 +11,8 @@ const { App, Service, Client, LoadBalancer } = require("systemlynx");
11
11
  Call `require("systemlynx")` and de-concatenate from the object it returns. The main abstractions used for client-to-server interactions are the following:
12
12
 
13
13
  - **Service** - Used to create and host objects that can be loaded and used by a SystemLynx Client.
14
- - **Client** - Used in a client application to load a _Service_, which contains all the objects added to the _Service_.
15
- - **App** - Provides a modular interface and lifecycle methods for asynchronously creating and loading _Services_.
14
+ - **Client** - Used in a client application to load a **Service**, which contains all the objects added to the **Service**.
15
+ - **App** - Provides a modular interface and lifecycle methods for asynchronously creating and loading **Services**.
16
16
 
17
17
  Find the full [API Documentation](https://github.com/Odion100/SystemLynx/blob/tasksjs2.0/API.md#tasksjs-api-documentation) here.
18
18
 
@@ -22,16 +22,16 @@ Find the full [API Documentation](https://github.com/Odion100/SystemLynx/blob/ta
22
22
 
23
23
  ## Service.ServerModule(name, constructor [,options])
24
24
 
25
- Use the `Service.ServerModule(name, constructor/object)` method to register an object to be hosted by a _SystemLynx Service_. This will allows you to load an instance of that object onto a client application, and call any methods on that object remotely.
25
+ Use the `Service.ServerModule(name, constructor/object)` method to add an object to be hosted by a **SystemLynx Service**. This will allows you to load an instance of that object into a client application, and call any methods on that object remotely.
26
26
 
27
27
  ```javascript
28
28
  const { Service } = require("systemlynx");
29
29
 
30
30
  const Users = {};
31
31
 
32
- Users.add = function (data, callback) {
32
+ Users.add = function (data) {
33
33
  console.log(data);
34
- callback(null, { message: "You have successfully called the Users.add method" });
34
+ return { message: "You have successfully called the Users.add method" };
35
35
  };
36
36
 
37
37
  Service.ServerModule("Users", Users);
@@ -39,17 +39,16 @@ Service.ServerModule("Users", Users);
39
39
 
40
40
  In the code above we assigned an object to the variable `Users` and gave it an add method. The `Service.ServerModule(name, constructor/object)` function takes the name assigned to the object as the first argument and the object itself as the second argument.
41
41
 
42
- Alternatively, you can use a constructor function instead of an object as the second argument. In the example below we create another _ServerModule_ called
43
- "Orders".
42
+ Alternatively, you can use a constructor function instead of an object as the second argument. In the example below we create another **ServerModule** called "Orders". This time we use a constructor function as the second argument of the to **Service.ServerModule** function. The `this` value is the initial instance of the **ServerModule** object. Every method added to the `this` value will be accessible when the object is loaded by a **SystemLynx Client**. Note: **ServerModule** methods can be synchronous or asynchronous functions.
44
43
 
45
44
  ```javascript
46
45
  const { Service } = require("systemlynx");
47
46
 
48
47
  const Users = {};
49
48
 
50
- Users.add = function (data, callback) {
49
+ Users.add = function (data) {
51
50
  console.log(data);
52
- callback(null, { message: "You have successfully called the Users.add method" });
51
+ return { message: "You have successfully called the Users.add method" };
53
52
  };
54
53
 
55
54
  Service.ServerModule("Users", Users);
@@ -57,27 +56,25 @@ Service.ServerModule("Users", Users);
57
56
  Service.ServerModule("Orders", function () {
58
57
  const Orders = this;
59
58
 
60
- Orders.find = function (arg1, arg2, callback) {
59
+ Orders.find = async function (arg1, arg2) {
61
60
  console.log(data);
62
- callback(null, { message: "You have successfully called the Orders.find method" });
61
+ return { message: "You have successfully called the Orders.find method" };
63
62
  };
64
63
  });
65
64
  ```
66
65
 
67
- In the _ServerModule_ constructor function above, the `this` value is the initial instance of the _ServerModule_ object. Every method added to the `this` value will be accessible when the object is loaded by a _SystemLynx Client_. Notice that the method we created, `Orders.find = function(arg1, arg2, callback)...`, has 3 parameters including a callback function as the last argument. By defualt all _ServerModule_ methods will recieve a callback function as its last argument. Use the first parameter of the callback function to respond with an error, and the second parameter to send a success response. Note: _ServerModule_ methods can be configured to work with synchronous return values instead of asynchronous callbacks (read more about Service configuration [here](https://github.com/Odion100/SystemLynx/blob/tasksjs2.0/API.md#apploadserviceurl)).
68
-
69
66
  ## Service.startService(options)
70
67
 
71
- Before we can access the objects hosted by this _Service_ from a client application, we need to call the `Service.startService(options)` function. This will start an **ExpressJS** Server and a **Socket.io** WebSocket Server, and set up routing for the _Service_. In the example below we added the `Service.startService(options)` function at the bottom, but the order does not matter.
68
+ Before we can access the objects hosted by this **Service** from a client application, we need to call the `Service.startService(options)` function. This will start an **ExpressJS** Server and a **Socket.io** WebSocket Server, and set up routing for the **Service**. In the example below we added the `Service.startService(options)` function at the bottom, but the order does not matter.
72
69
 
73
70
  ```javascript
74
71
  const { Service } = require("systemlynx");
75
72
 
76
73
  const Users = {};
77
74
 
78
- Users.add = function (data, callback) {
75
+ Users.add = function (data) {
79
76
  console.log(data);
80
- callback(null, { message: "You have successfully called the Users.add method" });
77
+ return { message: "You have successfully called the Users.add method" };
81
78
  };
82
79
 
83
80
  Service.ServerModule("Users", Users);
@@ -85,9 +82,9 @@ Service.ServerModule("Users", Users);
85
82
  Service.ServerModule("Orders", function () {
86
83
  const Orders = this;
87
84
 
88
- Orders.find = function (arg1, arg2, callback) {
85
+ Orders.find = function (arg1, arg2) {
89
86
  console.log(data);
90
- callback(null, { message: "You have successfully called the Orders.find method" });
87
+ return { message: "You have successfully called the Orders.find method" };
91
88
  };
92
89
  });
93
90
 
@@ -98,7 +95,7 @@ Now lets see how these objects can be loaded into a client application.
98
95
 
99
96
  ## Client.loadService(url, [options])
100
97
 
101
- The `Client.loadService(url)` function can be used to load a SystemLynx _Service_. This method requires the url (string) of the _Service_ you want to load as the first argument, and will return a promise that will resolve into an object that containing all the modules hosted by that service. See below. **NOTE: You must be within an async function in order to use the `await` keyword when returning a promise.**
98
+ The `Client.loadService(url)` function can be used to load a SystemLynx **Service**. This method requires the url (string) of the **Service** you want to load as the first argument, and will return a promise that will resolve into an object that containing all the modules hosted by that service. See below. **NOTE: You must be within an async function in order to use the `await` keyword when returning a promise.**
102
99
 
103
100
  ```javascript
104
101
  const { Client } = require("systemlynx");
@@ -108,7 +105,7 @@ const { Users, Orders } = await Client.loadService("http://localhost:4400/test/s
108
105
  console.log(Users, Orders);
109
106
  ```
110
107
 
111
- Now that we've loaded the _Service_ that we created in the previous example, and have a handle on the _Users_ and _Orders_ objects hosted by the _Service_, we can now call any method on those objects. In the example below, we demonstrate that when a methods for the ServerModule objects is called from the client, it can optionally take a callback as the last argument or, if a callback is not used, it will return a promise. With the `Users.add(data, callback)` method we used a callback, but with the `Orders.find(arg1, arg2, callback)` method we left out the callback function and used the `await` keyword to return a promise.
108
+ Now that we've loaded the **Service** that we created in the previous example, and have a handle on the **Users** and **Orders** objects hosted by the **Service**, we can now call any method on those objects in the same way we would remotely. In the example below, noticed that both the `User.add` and `Orders.find` methods will return a promise.
112
109
 
113
110
  ```javascript
114
111
  const { Client } = require("systemlynx");
@@ -117,10 +114,9 @@ const { Users, Orders } = await Client.loadService("http://localhost:4400/test/s
117
114
 
118
115
  console.log(Users, Orders);
119
116
 
120
- Users.add({ message: "Users.add Test" }, function (err, results) {
121
- if (err) console.log(err);
122
- else console.log(results);
123
- });
117
+ const results = await Users.add({ message: "Users.add Test" });
118
+
119
+ console.log(results);
124
120
 
125
121
  const response = await Orders.find("hello", "world");
126
122
 
@@ -129,7 +125,7 @@ console.log(response);
129
125
 
130
126
  ## Sending and Receiving Websocket Events
131
127
 
132
- We can also receive WebSocket events emitted from the remote objects we've loaded using the `Client.loadService(url)` function. In the example below we're using the `Users.on(event_name, callback)` method to listen for events coming from the "Users" _ServerModule_.
128
+ We can also receive WebSocket events emitted from the remote objects we've loaded using the `Client.loadService(url)` function. In the example below we're using the `Users.on(event_name, callback)` method to listen for events coming from the "Users" **ServerModule**.
133
129
 
134
130
  ```javascript
135
131
  const { Client } = require("systemlynx");
@@ -138,10 +134,9 @@ const { Users, Orders } = await Client.loadService("http://localhost:4400/test/s
138
134
 
139
135
  console.log(Users, Orders);
140
136
 
141
- Users.add({ message: "Users.add Test" }, function (err, results) {
142
- if (err) console.log(err);
143
- else console.log(results);
144
- });
137
+ const results = await Users.add({ message: "Users.add Test" });
138
+
139
+ console.log(results);
145
140
 
146
141
  Users.on("new_user", function (event) {
147
142
  console.log(event);
@@ -152,17 +147,17 @@ const response = await Orders.find("hello", "world");
152
147
  console.log(response);
153
148
  ```
154
149
 
155
- Now let's go to our server application and call the `Users.emit(event_name, data)` method to emit a websocket event that can be received by its corresponding Clients. Below, notice that we've added `Users.emit("new_user", { message:"new_user event test" })` at the end of the `Users.add` method, so the `new_user` event will be emitted every time this method is called.
150
+ Now let's go to our server application and call the `Users.emit(event_name, data)` method to emit a websocket event that can be received by its corresponding Clients. Below, notice that we've added `this.emit("new_user", { message:"new_user event test" })` at the end of the `Users.add` method, so the `new_user` event will be emitted every time this method is called. The `this` value of a **ServerModule** method will always be scoped to the **ServerModule** itself.
156
151
 
157
152
  ```javascript
158
153
  const { Service } = require("systemlynx");
159
154
 
160
155
  const Users = {};
161
156
 
162
- Users.add = function (data, callback) {
157
+ Users.add = function (data) {
163
158
  console.log(data);
164
- callback(null, { message: "You have successfully called the Users.add method" });
165
- Users.emit("new_user", { message: "new_user event test" });
159
+ return { message: "You have successfully called the Users.add method" };
160
+ this.emit("new_user", { message: "new_user event test" });
166
161
  };
167
162
 
168
163
  Service.ServerModule("Users", Users);
@@ -170,9 +165,9 @@ Service.ServerModule("Users", Users);
170
165
  Service.ServerModule("Orders", function () {
171
166
  const Orders = this;
172
167
 
173
- Orders.find = function (arg1, arg2, callback) {
168
+ Orders.find = function (arg1, arg2) {
174
169
  console.log(data);
175
- callback(null, { message: "You have successfully called the Orders.find method" });
170
+ return { message: "You have successfully called the Orders.find method" };
176
171
  };
177
172
  });
178
173
 
package/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  //These are all the abstractions that make up SystemLynx
2
2
  const { isNode } = require("./utils/ProcessChecker");
3
- const AppFactory = require("./systemlynx/App/App");
4
- const LoadBalancerFactory = require("./systemlynx/LoadBalancer/LoadBalancer");
5
- const ServiceFactory = require("./systemlynx/Service/Service");
6
- const ServerManagerFactory = require("./systemlynx/ServerManager/ServerManager");
7
- const ClientFactory = require("./systemlynx/Client/Client");
8
- const HttpClientFactory = require("./systemlynx/HttpClient/HttpClient");
9
- const DispatcherFactory = require("./systemlynx/Dispatcher/Dispatcher");
3
+ const SystemLynxApp = require("./systemlynx/App/App");
4
+ const SystemLynxLoadBalancer = require("./systemlynx/LoadBalancer/LoadBalancer");
5
+ const SystemLynxService = require("./systemlynx/Service/Service");
6
+ const SystemLynxServerManager = require("./systemlynx/ServerManager/ServerManager");
7
+ const SystemLynxClient = require("./systemlynx/Client/Client");
8
+ const SystemLynxHttpClient = require("./systemlynx/HttpClient/HttpClient");
9
+ const SystemLynxDispatcher = require("./systemlynx/Dispatcher/Dispatcher");
10
10
 
11
- const ServerManager = isNode ? ServerManagerFactory() : null;
12
- const Service = isNode ? ServiceFactory() : null;
13
- const LoadBalancer = isNode ? LoadBalancerFactory() : null;
11
+ const ServerManager = isNode ? SystemLynxServerManager() : null;
12
+ const Service = isNode ? SystemLynxService() : null;
13
+ const LoadBalancer = isNode ? SystemLynxLoadBalancer() : null;
14
14
 
15
- const App = AppFactory();
16
- const HttpClient = HttpClientFactory();
17
- const Client = ClientFactory();
18
- const Dispatcher = DispatcherFactory();
15
+ const App = SystemLynxApp();
16
+ const HttpClient = SystemLynxHttpClient();
17
+ const Client = SystemLynxClient();
18
+ const Dispatcher = SystemLynxDispatcher();
19
19
 
20
20
  module.exports = {
21
21
  //Export these pre-created objects for convenient object destructuring
@@ -30,11 +30,11 @@ module.exports = {
30
30
  //export all modules themselves
31
31
  //all these modules export factory functions
32
32
  //to ensure non-singleton behavior
33
- AppFactory,
34
- LoadBalancerFactory,
35
- ServiceFactory,
36
- ClientFactory,
37
- HttpClientFactory,
38
- ServerManagerFactory,
39
- DispatcherFactory,
33
+ SystemLynxApp,
34
+ SystemLynxLoadBalancer,
35
+ SystemLynxService,
36
+ SystemLynxClient,
37
+ SystemLynxHttpClient,
38
+ SystemLynxServerManager,
39
+ SystemLynxDispatcher,
40
40
  };
package/index.test.js CHANGED
@@ -6,22 +6,22 @@ const {
6
6
  Client,
7
7
  Service,
8
8
  ServerManager,
9
- AppFactory,
10
- LoadBalancerFactory,
11
- ServiceFactory,
12
- ClientFactory,
13
- HttpClientFactory,
14
- ServerManagerFactory,
9
+ SystemLynxApp,
10
+ SystemLynxLoadBalancer,
11
+ SystemLynxService,
12
+ SystemLynxClient,
13
+ SystemLynxHttpClient,
14
+ SystemLynxServerManager,
15
15
  } = require("./index");
16
16
 
17
- describe("SystemLynx Factory functions", () => {
18
- it("should return a factory functions for each SystemLynx abstraction", () => {
19
- expect(AppFactory).to.be.a("function");
20
- expect(LoadBalancerFactory).to.be.a("function");
21
- expect(ServiceFactory).to.be.a("function");
22
- expect(ClientFactory).to.be.a("function");
23
- expect(HttpClientFactory).to.be.a("function");
24
- expect(ServerManagerFactory).to.be.a("function");
17
+ describe("SystemLynxSystemLynx functions", () => {
18
+ it("should return aSystemLynx functions for each SystemLynx abstraction", () => {
19
+ expect(SystemLynxApp).to.be.a("function");
20
+ expect(SystemLynxLoadBalancer).to.be.a("function");
21
+ expect(SystemLynxService).to.be.a("function");
22
+ expect(SystemLynxClient).to.be.a("function");
23
+ expect(SystemLynxHttpClient).to.be.a("function");
24
+ expect(SystemLynxServerManager).to.be.a("function");
25
25
  });
26
26
 
27
27
  it("should return an instance of each SystemLynx abstraction", () => {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systemlynx",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,7 +4,6 @@ const ServiceFactory = require("../Service/Service");
4
4
  const SystemObject = require("./components/SystemObject");
5
5
  const Dispatcher = require("../Dispatcher/Dispatcher");
6
6
  const initializeApp = require("./components/initializeApp");
7
- const URL = require("url");
8
7
 
9
8
  module.exports = function SystemLynxApp() {
10
9
  const App = Dispatcher();
@@ -67,7 +66,7 @@ module.exports = function SystemLynxApp() {
67
66
  system.configurations = { __constructor, module: SystemObject(system) };
68
67
  else
69
68
  throw Error(
70
- "App.config methods requires a constructor function as it first parameter."
69
+ "[SystemLynx][App][Error]: App.config(...) methods requires a constructor function as its first parameter."
71
70
  );
72
71
  return App;
73
72
  };
@@ -18,7 +18,7 @@ module.exports = async function initApp(system) {
18
18
  try {
19
19
  await loadServices(system);
20
20
  } catch (err) {
21
- throw `(AppERROR): Initialization Error - failed to load all services`;
21
+ throw `[SystemLynx][App][Error]: Initialization Error - failed to load all services`;
22
22
  }
23
23
 
24
24
  if (typeof system.configurations.__constructor === "function") {
@@ -27,7 +27,7 @@ module.exports = async function initApp(system) {
27
27
  () => {
28
28
  configComplete = true;
29
29
  loadModules(system);
30
- }
30
+ },
31
31
  ]);
32
32
  } else loadModules(system);
33
33
  };
@@ -10,5 +10,5 @@ module.exports = async function loadModules(system) {
10
10
  system.Service.ServerModule(name, __constructor)
11
11
  );
12
12
  if (system.routing) await system.Service.startService(system.routing);
13
- system.App.emit("init_complete", system);
13
+ system.App.emit("ready", system);
14
14
  };
@@ -45,7 +45,7 @@ describe("App: Loading Services", () => {
45
45
  await new Promise((resolve) => {
46
46
  const App = AppFactory();
47
47
  App.loadService("test", `http://localhost:${port}/${route}`).on(
48
- "init_complete",
48
+ "ready",
49
49
  (system) => {
50
50
  expect(system.Services[0]).to.be.an("object");
51
51
 
@@ -151,7 +151,7 @@ describe("App: Loading Services", () => {
151
151
  .that.respondsTo("resetConnection");
152
152
  resolve();
153
153
  })
154
- .on("init_complete", resolve);
154
+ .on("ready", resolve);
155
155
  });
156
156
  });
157
157
  });
@@ -189,7 +189,7 @@ describe("App SystemObjects: Initializing Modules, ServerModules and configurat
189
189
  const url = `http://localhost:${port}/${route}`;
190
190
 
191
191
  await new Promise((resolve) =>
192
- App.startService({ route, port }).on("init_complete", resolve)
192
+ App.startService({ route, port }).on("ready", resolve)
193
193
  );
194
194
  const connData = await HttpClient.request({ url });
195
195
 
@@ -223,7 +223,7 @@ describe("App SystemObjects: Initializing Modules, ServerModules and configurat
223
223
  this.test = () => {};
224
224
  this.test2 = () => {};
225
225
  })
226
- .on("init_complete", resolve)
226
+ .on("ready", resolve)
227
227
  );
228
228
 
229
229
  const connData = await HttpClient.request({ url });
@@ -253,7 +253,7 @@ describe("App SystemObjects: Initializing Modules, ServerModules and configurat
253
253
  ]);
254
254
  });
255
255
 
256
- it('should be able to use App.on("init_complete", callback) fire a callback when App initialization is complete', async () => {
256
+ it('should be able to use App.on("ready", callback) fire a callback when App initialization is complete', async () => {
257
257
  const App = AppFactory();
258
258
 
259
259
  App.ServerModule("mod", function () {
@@ -265,7 +265,7 @@ describe("App SystemObjects: Initializing Modules, ServerModules and configurat
265
265
  });
266
266
 
267
267
  await new Promise((resolve) =>
268
- App.on("init_complete", (system) => {
268
+ App.on("ready", (system) => {
269
269
  expect(system)
270
270
  .to.be.an("object")
271
271
  .that.has.all.keys(
@@ -303,7 +303,7 @@ describe("App SystemObjects: Initializing Modules, ServerModules and configurat
303
303
  });
304
304
 
305
305
  await new Promise((resolve) =>
306
- App.on("init_complete", ({ configurations }) => {
306
+ App.on("ready", ({ configurations }) => {
307
307
  expect(configurations)
308
308
  .to.be.an("object")
309
309
  .that.has.all.keys("module", "__constructor")
@@ -349,6 +349,6 @@ describe("SystemObjects", () => {
349
349
  this.configPassed = true;
350
350
  next();
351
351
  });
352
- return new Promise((resolve) => App.on("init_complete", () => resolve()));
352
+ return new Promise((resolve) => App.on("ready", () => resolve()));
353
353
  });
354
354
  });
@@ -49,7 +49,7 @@ module.exports = function ServiceRequestHandler(method, fn, resetConnection) {
49
49
  console.log(err);
50
50
  errCount++;
51
51
  resetConnection(() => tryRequest(cb, errCount));
52
- } else throw Error(`(SystemLynxServiceError): Invalid route:${err}`);
52
+ } else throw Error(`[SystemLynx][Service][Error]: Invalid route:${err}`);
53
53
  };
54
54
 
55
55
  return new Promise((resolve, reject) =>
@@ -11,7 +11,7 @@ module.exports = function loadConnectionData(url, { limit = 10, wait = 150 } = {
11
11
  if (errors.length < limit)
12
12
  setTimeout(() => getData(resolve), errors.length * wait);
13
13
  else
14
- throw `SystemLynx loadConnectionData() Error: url:${url}, attempts:${errors.length}`;
14
+ throw `[SystemLynx][Client][Error]: Failed to load Service @${url} after ${errors.length} attempts.`;
15
15
  } else resolve(results);
16
16
  });
17
17
  });
@@ -10,7 +10,7 @@ module.exports = function SystemLynxDispatcher(events = {}) {
10
10
  Dispatcher.on = (eventName, callback) => {
11
11
  if (typeof callback !== "function")
12
12
  throw Error(
13
- "SystemLynxDispatcher Error: object.on(eventName, callback) invalid parameters"
13
+ "[SystemLynx][EventHandler][Error]: EventHandler.on(eventName, callback) received invalid parameters"
14
14
  );
15
15
  if (!events[eventName]) events[eventName] = [];
16
16
  events[eventName].push(callback);
@@ -16,10 +16,7 @@ module.exports = function SystemLynxServerManager() {
16
16
  useREST: false,
17
17
  useService: true,
18
18
  staticRouting: false,
19
- validateArgs: true,
20
19
  middleware: [],
21
- useCallbacks: true,
22
- useReturnValues: false,
23
20
  };
24
21
  const server = SystemLynxServer();
25
22
  const router = SystemLynxRouter(server, () => serverConfigurations);
@@ -66,7 +63,7 @@ module.exports = function SystemLynxServerManager() {
66
63
 
67
64
  return new Promise((resolve) =>
68
65
  server.listen(port, () => {
69
- console.log(`(SystemLynxService): ${route} --> Listening on ${host}:${port}`);
66
+ console.log(`[SystemLynx][Service]: Listening on ${serviceUrl}`);
70
67
  moduleQueue.forEach(({ name, object, reserved_methods }) =>
71
68
  ServerManager.addModule(name, object, reserved_methods)
72
69
  );
@@ -15,11 +15,17 @@ module.exports = function ServiceFactory({ defaultModule = {} } = {}) {
15
15
 
16
16
  if (typeof constructor === "function") {
17
17
  if (constructor.constructor.name === "AsyncFunction")
18
- throw `(ServerModule Error): ServerModule(name, constructor) function requires a non-async function as the constructor`;
18
+ throw `[SystemLynx][ServerModule][Error]: ServerModule(name, constructor) function cannot receive an async function as the constructor`;
19
19
 
20
20
  const ServerModule = Dispatcher.apply({ ...Service.defaultModule });
21
- const exclude_methods = [...reserved_methods, ...Object.getOwnPropertyNames(ServerModule)];
22
- constructor.apply(ServerModule, [ServerManager.Server(), ServerManager.WebSocket()]);
21
+ const exclude_methods = [
22
+ ...reserved_methods,
23
+ ...Object.getOwnPropertyNames(ServerModule),
24
+ ];
25
+ constructor.apply(ServerModule, [
26
+ ServerManager.Server(),
27
+ ServerManager.WebSocket(),
28
+ ]);
23
29
  ServerManager.addModule(name, ServerModule, exclude_methods);
24
30
  return ServerModule;
25
31
  }