-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsampleCode.js
More file actions
31 lines (26 loc) · 1.03 KB
/
sampleCode.js
File metadata and controls
31 lines (26 loc) · 1.03 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
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var PredictiveServiceClient = require('dato-predictive-service-client');
var end_point = "http://localhost:9005"
var api_key = "api_key"
var client = new PredictiveServiceClient(end_point,api_key);
client.setShouldVerifyCertificate(false);
console.log(client);
var data = {'a':1,'b':2}
var uuid = ""
client.query('add', data, function(err, resp) {
if (err != null) {
throw new Error(err);
} else {
console.log(resp.statusCode); // status code of the response
console.log(resp.data); // response data
var feedback_data = {'result':'correct'};
client.feedback(resp.data.uuid, feedback_data, function(err, resp) {
console.log(resp);
});
}
});
res.end("Thanks for contacting me!");
}).listen(3000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3000/');