e27ebaa6 by Julien Breux

Add title management

1 parent fd8ad210
Showing 1 changed file with 7 additions and 1 deletions
......@@ -9,6 +9,7 @@
let io;
const defaultConfig = {
title: 'Express Status',
path: '/status',
spans: [{
interval: 1,
......@@ -95,7 +96,12 @@
const startTime = process.hrtime();
if (req.path === config.path) {
res.sendFile(path.join(__dirname + '/index.html'));
fs.readFile(path.join(__dirname + '/index.html'), function(err, content) {
content = content.toString().replace(new RegExp(defaultConfig.title, 'g'), config.title);
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(content);
res.end();
});
} else {
onHeaders(res, () => {
const diff = process.hrtime(startTime);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!