aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBuildTools <unconfigured@null.spigotmc.org>2017-10-01 11:44:21 +0200
committerBuildTools <unconfigured@null.spigotmc.org>2017-10-01 11:44:21 +0200
commitb658c4360685e816bc0b21e567ffd16724571dcb (patch)
tree0a621b3a00b107d90c2feea02b28cc910daf0b23
parentcss (diff)
log files
-rw-r--r--.gitignore2
-rw-r--r--app.js12
2 files changed, 13 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index b56c7b9..df5ce31 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
md
md/
node_modules/
+node.access.log
+node.error.log
diff --git a/app.js b/app.js
index efb2989..8a4313b 100644
--- a/app.js
+++ b/app.js
@@ -9,6 +9,12 @@ const converter = new showdown.Converter();
const app = express();
const path = 'md';
+const access = fs.createWriteStream('node.access.log', {flags: 'a'});
+const error = fs.createWriteStream('node.error.log', {flags: 'a'});
+
+process.stdout.write = access.write.bind(access);
+process.stderr.write = error.write.bind(error);
+
converter.setOption('parseImgDimensions', 'true');
converter.setOption('literalMidWordUnderscores', 'true');
converter.setOption('literalMidWordAsterisks', 'true');
@@ -19,6 +25,7 @@ converter.setOption('tasklists', 'true');
app.use(express.static('public'));
app.get('/' + path + '/*', function(req, res) {
+ console.log("200 - " + req.url);
fs.readFile(req.url.substr(1), 'utf8', function(err, data) {
if (err)
return console.log(err);
@@ -27,16 +34,19 @@ app.get('/' + path + '/*', function(req, res) {
});
app.get('/data', function(req, res) {
+ console.log("200 - " + req.url);
res.send(dirTree(path, {extensions:/\.md/}));
});
app.get('/img/*', function (req, res) {
+ console.log("200 - " + req.url);
var img = fs.readFileSync(req.url.replace('/img', path));
res.writeHead(200, {'Content-Type': 'image/gif' });
res.end(img, 'binary');
});
app.get('/', function(req, res) {
+ console.log("200 - " + req.url);
fs.readFile('public/index.html', 'utf8', function(err, data) {
if (err)
return console.log(err);
@@ -45,7 +55,7 @@ app.get('/', function(req, res) {
});
app.get('*', function(req, res) {
- console.log("404 - " + req.url);
+ console.error("404 - " + req.url);
fs.readFile('public/404.md', 'utf8', function(err, data) {
if (err)
return console.log(err);