UNPKG

785 BJavaScriptView Raw
1"use strict";
2
3var http = require('http'),
4 nextMeeting;
5
6var options = {
7 hostname: 'www.jaxnode.com',
8 port: 80,
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 = http.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 //console.log(nextMeeting);
29 cb(nextMeeting);
30 });
31 });
32 req.end();
33 req.on('error', function(err) {
34 console.log(err);
35 cb(err);
36 });
37};
38
39module.exports = new JnnData();
\No newline at end of file