-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
60 lines (47 loc) · 1.2 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import {
Users
}
from "meteor-user-roles";
import { Apimoons } from "/lib/collections/apimoons.js";
Meteor.publish("users", () => {
console.log("in publish users");
return Meteor.users.find( {}, {fields: {"profile.name":1} });
});
Meteor.methods( {
"connection_status"(args) {
console.log("User connection registered args=",args);
console.log("this=",this);
// count online users
// count total users
}
});
Meteor.startup(function() {
// read environment variables from Meteor.settings
if (Meteor.settings && Meteor.settings.env && _.isObject(Meteor.settings.env)) {
for (var variableName in Meteor.settings.env) {
process.env[variableName] = Meteor.settings.env[variableName];
}
}
console.log("In server startup..");
Apimoons.remove({});
let leftCode = Assets.getText("left-code.js");
let middleCode = Assets.getText("middle-code.js");
let rightCode = Assets.getText("right-code.js");
for (let i = 0; i < 10; i++) {
Apimoons.insert({
name: "API " + i,
"left": {
name: "HTTP REST INPUT",
code: leftCode
},
middle: {
name: "GraphQL Schema",
code: middleCode
},
right: {
name: "GraphQL Resolver to HTTP REST",
code: rightCode
},
});
}
});