Created
October 31, 2013 07:15
-
-
Save elpargo/7245461 to your computer and use it in GitHub Desktop.
This is a test for our calendar app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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