Skip to content

Instantly share code, notes, and snippets.

@elpargo
Created October 31, 2013 07:15
Show Gist options
  • Save elpargo/7245461 to your computer and use it in GitHub Desktop.
Save elpargo/7245461 to your computer and use it in GitHub Desktop.
This is a test for our calendar app.
var ical = require('ical');
var http = require('http');
var express = require('express');
var app = express();
var json = [];
ical.fromURL('http://lanyrd.com/topics/nodejs/nodejs.ics', {}, function(err, data) {
json = data
for (var k in data){
if (data.hasOwnProperty(k)) {
var ev = data[k]
console.log(k);
// json.push(JSON.stringify(ev));
}
}
});
app.get('/', function(req, res){
res.send(JSON.stringify(json));
});
app.get("/:id", function(req, res){
res.send(JSON.stringify(json[req.params.id]));
});
app.listen(3000);
console.log('Listening on port 3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment