looking for some solutions? You are welcome.

SOLVED: How to render a log file in browser through url using node js?


I am trying to render a log file in the browser by hitting a url. The log file is placed in my local (logs/app.log). I am stuck with this for a day.. Please find my node js code.

var app = express();
var path = require('path');
app.use('/logs', express.static(__dirname + '/logs'));

app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
  console.log('Express server listening on port ' + server.address().port);

Please help me to resolve this issue.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: