webfast 0.1.68 → 0.1.69
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/modules/data/mongo/find.js +11 -10
- package/package.json +1 -1
- package/example.js +0 -68
@@ -11,15 +11,6 @@ module.exports = async function(db,collection,query,one = false,array) {
|
|
11
11
|
process.exit(1);
|
12
12
|
}
|
13
13
|
|
14
|
-
function routeExists(path) {
|
15
|
-
return program.express.app._router.stack.some(layer => {
|
16
|
-
if (layer.route) {
|
17
|
-
return layer.route.path === path;
|
18
|
-
}
|
19
|
-
return false;
|
20
|
-
});
|
21
|
-
}
|
22
|
-
|
23
14
|
// Define the MongoDB URI
|
24
15
|
const uri = process.env.mongo;
|
25
16
|
|
@@ -53,6 +44,16 @@ module.exports = async function(db,collection,query,one = false,array) {
|
|
53
44
|
// Process the result
|
54
45
|
console.log('Query result:', result);
|
55
46
|
|
47
|
+
|
48
|
+
async function routeExists(path) {
|
49
|
+
return program.express.app._router.stack.some(layer => {
|
50
|
+
if (layer.route) {
|
51
|
+
return layer.route.path === path;
|
52
|
+
}
|
53
|
+
return false;
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
56
57
|
// Check if profile image to get it from db
|
57
58
|
if (result.profileImage != undefined && array.image == true) {
|
58
59
|
const profileImage = await program.modules.data.file.downloadBuffer(result.profileImage,process.env.dbName);
|
@@ -129,6 +130,6 @@ module.exports = async function(db,collection,query,one = false,array) {
|
|
129
130
|
}
|
130
131
|
|
131
132
|
// Execute the main function
|
132
|
-
await main().catch(console.error);
|
133
|
+
return await main().catch(console.error);
|
133
134
|
|
134
135
|
}
|
package/package.json
CHANGED
package/example.js
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
const path = require(`path`);
|
2
|
-
const contentPath = path.join(__dirname,`example`,`content`)
|
3
|
-
let setArray = {
|
4
|
-
wget : '/usr/local/bin/wget',
|
5
|
-
process : {
|
6
|
-
ts : Date.now(),
|
7
|
-
socket : {
|
8
|
-
api : {
|
9
|
-
list : function(program,ws,json,data,path) {
|
10
|
-
// Example to create process for websocket path action and process data
|
11
|
-
console.log(`Example of list process`);
|
12
|
-
|
13
|
-
function generateRandomText(length) {
|
14
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
15
|
-
let result = '';
|
16
|
-
|
17
|
-
for (let i = 0; i < length; i++) {
|
18
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
19
|
-
}
|
20
|
-
|
21
|
-
return result;
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
// Loop for example through
|
26
|
-
let exampleData = {
|
27
|
-
list : [],
|
28
|
-
ell : data.ell,
|
29
|
-
action : data.action
|
30
|
-
}
|
31
|
-
|
32
|
-
const pushData = {};
|
33
|
-
for (let i in data.other.items) {
|
34
|
-
const item = data.other.items[i];
|
35
|
-
// We have itme
|
36
|
-
const id = item.id;
|
37
|
-
const key = item.name;
|
38
|
-
|
39
|
-
pushData[key] = {
|
40
|
-
id : id,
|
41
|
-
text : generateRandomText(10)
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
pushData.uuid = program.uuid.v4();
|
46
|
-
exampleData.list.push(pushData);
|
47
|
-
|
48
|
-
// Send websocket message create standard
|
49
|
-
const sendObject = {
|
50
|
-
func : data.function,
|
51
|
-
data : exampleData,
|
52
|
-
js : `console.log("RUN FROM BACKEND")`
|
53
|
-
}
|
54
|
-
|
55
|
-
// Sedn back to front-end
|
56
|
-
//ws.send();
|
57
|
-
|
58
|
-
return sendObject;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
},
|
63
|
-
contentPath : contentPath
|
64
|
-
};
|
65
|
-
|
66
|
-
|
67
|
-
let program = require(path.join(__dirname,`index.js`))(setArray);
|
68
|
-
console.log(`Required`);
|