-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathviewer.js
38 lines (32 loc) · 1.25 KB
/
viewer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/** Copyright 2015 Board of Trustees of University of Illinois
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const db = require('../db/db');
const utils = require('../utils/logging');
const perror = utils.perror;
//const viewerMustache = fs.readFileSync(mustachePath + 'viewer.mustache').toString();
router.get('/viewer/:offeringId', ensureAuthenticated, function (request, response) {
var className = request.params.className.toLowerCase();
/* TODO: don't think this is the correct function */
db.getCourseId(function(err, results) {
// client.smembers("ClassTranscribe::CourseList", function(err, results) {
if (!isClassNameValid(className) || err) {
perror("not valid course: " + className);
response.end(invalidClassHTML);
return;
}
});
response.writeHead(200, {
'Content-Type': 'text/html',
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST, GET, PUT, DELETE, OPTIONS"
});
var view = {
className: className
};
renderWithPartial(Mustache.getMustacheTemplate('viewer.mustache'), request, response, view);
});
module.exports = router;