molly-db 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
package/main.js CHANGED
@@ -25,10 +25,11 @@ class molly_db{
25
25
  this.path = path.join(process.cwd(),opt.path);
26
26
  else this.path = opt.path;
27
27
 
28
+ this.host = opt.host || 'localhost';
28
29
  this.protocol = opt.protocol || 'http';
29
- this.time = opt.saveTime || .1;
30
- this.import = opt.import || '';
31
- this.threads = opt.thread|| 1;
30
+ this.time = opt.saveTime || .1;
31
+ this.import = opt.import || '';
32
+ this.threads = opt.thread || 1;
32
33
 
33
34
  return require(dir)(this);
34
35
  }
@@ -8,31 +8,34 @@ const ws = require('ws');
8
8
  /*--────────────────────────────────────────────────────────────────────────────────────────────--*/
9
9
 
10
10
  function createHTTPServer(){
11
- http.createServer( app.http ).listen( process.env.port,()=>{
11
+ http.createServer( app.http ).listen( process.env.port, process.env.host, ()=>{
12
12
  console.log({
13
13
  protocol: 'HTTP', status: 'started',
14
14
  wrkID: process.pid, port: process.env.port,
15
+ host: process.env.host
15
16
  });
16
17
  });
17
18
  }
18
19
 
19
20
  function createWebSocketServer(){
20
- const srv = new ws.WebSocketServer({ port: process.env.port });
21
+ const srv = new ws.WebSocketServer({ port: process.env.port, host: process.env.host });
21
22
  srv.on('connection',(client)=>{
22
23
  client.on('message',(msg)=>app.WebSocket(msg,client));
23
24
  }); console.log ({
24
25
  protocol: 'WebSocket', status: 'started',
25
26
  wrkID: process.pid, port: process.env.port,
27
+ host: process.env.host
26
28
  });
27
29
  }
28
30
 
29
31
  function createSocketServer(){
30
- const srv = net.createServer({ port: process.env.port });
32
+ const srv = net.createServer({ port: process.env.port, host: process.env.host });
31
33
  srv.on('connection',(client)=>{
32
34
  client.on('message',(msg)=>app.Socket(msg,client));
33
35
  }); console.log ({
34
36
  protocol: 'Socket', status: 'started',
35
37
  wrkID: process.pid, port: process.env.port,
38
+ host: process.env.host
36
39
  });
37
40
  }
38
41
 
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
- "scripts": { "start": "node main" },
2
+ "scripts": {
3
+ "start": "node main"
4
+ },
3
5
  "repository": "https://github.com/EDBC-REPO-NPM/Molly-db",
4
6
  "dependencies": {
5
- "molly-fetch": "^1.0.16",
6
7
  "crypto-js": "^4.1.1",
8
+ "molly-fetch": "^1.1.2",
7
9
  "ws": "^8.11.0"
8
10
  },
9
11
  "license": "MIT",
10
12
  "main": "main.js",
11
13
  "name": "molly-db",
12
- "version": "1.3.4",
14
+ "version": "1.3.5",
13
15
  "author": "bececrazy",
14
16
  "description": "Molly-db is a free and open source library for nodejs that allow you create a lightweight encrypted database using Json files",
15
17
  "keywords": [