-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (31 loc) · 874 Bytes
/
index.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
var path = require('path'),
mime = require('mime');
module.exports = function (seminarjs) {
if (typeof (seminarjs) == 'undefined') {
console.error('[ERROR] Seminarjs not detected');
process.exit(-1);
}
try {
// Contest plugin endpoint for css/js client files
seminarjs.app.use('/plugins/contest/', function (req, res, next) {
if (req.method !== 'GET') {
next();
return;
}
res.sendFile(__dirname + "/public/" + req.path);
});
// Add the contest endpoint to show each user's progress
seminarjs.app.get('/contest/index.html', function (req, res, next) {
if (req.method !== 'GET') {
next();
return;
}
res.sendFile(__dirname + "/public/html/index.html");
});
// Start the server
var contestServer = require('./src/contest-server.js');
contestServer(seminarjs);
} catch (e) {
console.error(e.getMessage());
}
};