-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.js
More file actions
30 lines (24 loc) · 706 Bytes
/
Copy pathweb.js
File metadata and controls
30 lines (24 loc) · 706 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
var express = require("express");
var logfmt = require("logfmt");
var path = require("path");
var app = express();
app.use(logfmt.requestLogger());
function setHeaders(res,pth,stat) {
console.log(pth)
if (path.extname(pth) == ".svgz") {
res.setHeader("Content-Encoding", "gzip");
}
if (path.extname(pth) == ".manifest") {
res.setHeader("Content-Type", "text/cache-manifest");
}
}
app.use("/", express.static('static', {
"setHeaders": setHeaders,
}));
app.get('/books', function(req, res) {
res.redirect('http://159.203.85.77:5000');
});
var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
console.log("Listening on " + port);
});