UNPKG

720 BJavaScriptView Raw
1"use strict";
2
3var https = require('https'),
4 nextMeeting;
5
6var options = {
7 hostname: 'www.jaxnode.com',
8 port: 443,
9 path: '/api',
10 method: 'GET',
11 headers: {
12 'Content-Type': 'application/x-www-form-urlencoded'
13 }
14};
15
16var JnnData = function() {};
17
18JnnData.prototype.getNextMeeting = function(cb) {
19 var req = https.request(options, function (response) {
20 var result = '';
21 response.setEncoding('utf8');
22 response.on('data', function (chunk) {
23 //console.log(chunk);
24 result += chunk;
25 });
26 response.on('end', function() {
27 nextMeeting = JSON.parse(result);
28 cb(nextMeeting);
29 });
30 });
31 req.end();
32 req.on('error', function(err) {
33 console.log(err);
34 cb(err);
35 });
36};
37
38module.exports = new JnnData();
\No newline at end of file