forked from cotsog/JavaScriptSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
62 lines (47 loc) · 1.47 KB
/
Copy pathserver.js
File metadata and controls
62 lines (47 loc) · 1.47 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
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var request = require('request');
var CB = require('./dist/cloudboost');
var Chance = require('chance');
var chance = new Chance();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
runTests();
//Ending
app.set('port', process.env.PORT || 6000);
var server = app.listen(app.get('port'), function() {
console.log("Javascript SDK started on PORT:"+app.get('port'));
});
function runTests(){
/*CB.CloudApp.init("nrddmqjisjeh","0b80afe7-24ad-4019-a0ae-43e4b2259c1c");
CB.CloudNotification.publish('ChannelName','hola mi amigo');
var SECURE_KEY = "b8e40eda-3ec2-4e9e-b30c-8195be38fbae";
var URL = "http://localhost:4730";
var appId = chance.word();
var url = URL+'/app/'+appId;
var params = {};
params.secureKey = SECURE_KEY;
request({
url: url, //URL to hit
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
json: params //Set the body as a string
}, function(error, response, json){
if(error) {
done(error);
} else {
CB.CloudApp.init(URL, json.appId, json.keys.js);
CB.masterKey = json.keys.master;
CB.jsKey = json.keys.js;
var url = CB.serverUrl+'/db/mongo/connect';
CB._request('POST',url).then(function() {
console.log("SUCEESS");
},function(err){
console.log(err)
});
}
});*/
}