-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (21 loc) · 682 Bytes
/
server.js
File metadata and controls
34 lines (21 loc) · 682 Bytes
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
var http = require('http');
var refreshManager = require('./refreshManager');
var fileCacheReader = require('./fileCacheReader');
var port = 9100;
/* this is the main server that handles all requests.
needs to check the file cache, pass through request to origin
and stuff.
- should canonicalize the requested url
*/
var server = http.createServer(function (req, res) {
if (req.url == "/checkQueue") {
refreshManager.checkQueue();
} else {
console.log("Cache Server: " + req.url)
fileCacheReader.read(req.url, res)
}
});
server.listen(port, "0.0.0.0", function() {
console.log("Caching Server: listening on: " + port);
});
exports.server = server;