@bee.js/node 0.0.64 → 0.0.66

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.
@@ -1,30 +1,39 @@
1
- const log = require('./log')
2
- const beeDEV = require('../DEV/beeDEV')
3
- const https = require('https')
4
- const fs = require('fs')
5
-
6
- module.exports = function(app) {
7
-
8
- let ports = (global.configs.port || global.configs.ports || 1987.443).toString().split('.')
9
-
10
- app.post('/beedev/:action', beeDEV) //TODO check security and create a method for define enable/disable
11
-
12
- app.listen(ports[0])
13
-
14
- log(`${configs.name || 'Bee.js'} started.`)
15
- log(`${configs.name || 'System'} listening at http://localhost:${ports[0]}`)
16
-
17
- if(ports.length === 1) return
18
-
19
- let certificate = fs.existsSync(require.main.path + '/server/certificate/cert.pem')
20
- ? {
21
- key: fs.readFileSync(require.main.path + '/server/certificate/key.pem'),
22
- cert: fs.readFileSync(require.main.path + '/server/certificate/cert.pem'),
23
- passphrase: 'beejs.org'
24
- }
25
- : {}
26
-
27
- https.createServer(certificate, app).listen(ports[1])
28
-
29
- log(`${configs.name || 'Bee.js'} listening at https://localhost:${ports[1]}`)
30
- }
1
+ const log = require("./log");
2
+ const beeDEV = require("../DEV/beeDEV");
3
+ const https = require("https");
4
+ const fs = require("fs");
5
+
6
+ module.exports = function (app, { ws } = {}) {
7
+ const ports = (global.configs.port || global.configs.ports || 1987.443)
8
+ .toString()
9
+ .split(".");
10
+
11
+ app.post("/beedev/:action", beeDEV); //TODO check security and create a method for define enable/disable
12
+
13
+ app.listen(ports[0], () => {
14
+ ws?.({ app });
15
+ });
16
+
17
+ log(`${configs.name || "Bee.js"} started.`);
18
+ log(`${configs.name || "System"} listening at http://localhost:${ports[0]}`);
19
+
20
+ if (ports.length === 1) return;
21
+
22
+ const certificate = fs.existsSync(
23
+ require.main.path + "/server/certificate/cert.pem"
24
+ )
25
+ ? {
26
+ key: fs.readFileSync(require.main.path + "/server/certificate/key.pem"),
27
+ cert: fs.readFileSync(
28
+ require.main.path + "/server/certificate/cert.pem"
29
+ ),
30
+ passphrase: "beejs.org",
31
+ }
32
+ : {};
33
+
34
+ const server = https.createServer(certificate, app).listen(ports[1]);
35
+
36
+ log(`${configs.name || "Bee.js"} listening at https://localhost:${ports[1]}`);
37
+
38
+ return server;
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {