-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeorg.js
More file actions
66 lines (58 loc) · 3.13 KB
/
georg.js
File metadata and controls
66 lines (58 loc) · 3.13 KB
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
61
62
63
64
65
66
if (Meteor.isClient) {
Meteor.subscribe('polygons', 'bob-smith');
Meteor.subscribe('events', 'bob-smith');
Meteor.subscribe('positions', 'bob-smith');
}
if (Meteor.isServer) {
Meteor.publish('polygons', function() {
return Polygons.find({});
});
Meteor.publish('events', function() {
return Events.find({});
});
Meteor.publish('positions', function() {
return Positions.find({});
});
}
Meteor.startup(function(){
//if(Posts.) Kolla om posts är empty
//Posts.remove({});
console.log("Startup");
// All values listed below are default
collectionApi = new CollectionAPI({
authToken: undefined, // Require this string to be passed in on each request
apiPath: 'collectionapi', // API path prefix
standAlone: false, // Run as a stand-alone HTTP(S) server
sslEnabled: false, // Disable/Enable SSL (stand-alone only)
listenPort: 3005, // Port to listen to (stand-alone only)
listenHost: undefined, // Host to bind to (stand-alone only)
privateKeyFile: 'privatekey.pem', // SSL private key file (only used if SSL is enabled)
certificateFile: 'certificate.pem' // SSL certificate key file (only used if SSL is enabled)
});
// Add the collection Events to the API "/events" path
collectionApi.addCollection(Events, 'events', {
// All values listed below are default
authToken: undefined, // Require this string to be passed in on each request
methods: ['POST','GET','PUT','DELETE'], // Allow creating, reading, updating, and deleting
before: { // This methods, if defined, will be called before the POST/GET/PUT/DELETE actions are performed on the collection. If the function returns false the action will be canceled, if you return true the action will take place.
POST: undefined, // function(obj) {return true/false;},
GET: undefined, // function(collectionID, objs) {return true/false;},
PUT: undefined, //function(collectionID, obj, newValues) {return true/false;},
DELETE: undefined, //function(collectionID, obj) {return true/false;}
}
});
// Add the collection Positions to the API "/positions" path
collectionApi.addCollection(Positions, 'positions', {
// All values listed below are default
authToken: undefined, // Require this string to be passed in on each request
methods: ['POST','GET','PUT','DELETE'], // Allow creating, reading, updating, and deleting
before: { // This methods, if defined, will be called before the POST/GET/PUT/DELETE actions are performed on the collection. If the function returns false the action will be canceled, if you return true the action will take place.
POST: undefined, // function(obj) {return true/false;},
GET: undefined, // function(collectionID, objs) {return true/false;},
PUT: undefined, //function(collectionID, obj, newValues) {return true/false;},
DELETE: undefined, //function(collectionID, obj) {return true/false;}
}
});
// Starts the API server
collectionApi.start();
});