Commit 7916c1eb authored by Mark Stenglein's avatar Mark Stenglein

Merge branch 'issue21-ical-npm' into '1.0'

Issue21 ical npm

Closes #21

See merge request !8
parents b71556b7 eb6f368f
......@@ -10,7 +10,7 @@
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"express": "~4.13.4",
"ical-generator": "git+https://github.com/srct/ical-generator.git",
"ical-generator": "^0.2.8",
"mongoose": "^4.5.5",
"mongoose-redis-cache": "0.0.3",
"morgan": "~1.7.0",
......
......@@ -8,6 +8,7 @@ var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var Semester = require('../../models/Semester');
var ical = require('ical-generator');
// Load site wide configurations
var config = require('../../config');
......@@ -45,5 +46,20 @@ router.get('/json/classes/:SEMSLUG', function(req, res, next) {
////////////////////////////////////////////////////////////////////////////////
// ICAL API Section
router.get('/ical/:SCHOOL/:SEMSLUG/:CLASSES', function(req, res, next) {
var schoolSlug = req.params['SCHOOL'];
var semSlug = req.params['SEMSLUG'];
var classes = req.params['CLASSES'];
// Generate blank calendar
cal = ical({domain: 'schedules.gmu.edu', name: 'SRCT Schedules Generated Calendar'});
res.set({
'Content-Type': 'text/calendar; charset=utf-8',
'Content-Disposition': 'attachment; filename="' + ('calendar.ics') + '"'
});
res.send(cal.toString());;
})
module.exports = router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment