d30faec1 by Rafal Wilinski

:ring: Fix constant port

1 parent af7c56fb
......@@ -136,7 +136,7 @@
Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)";
Chart.defaults.global.elements.line.borderWidth = 2;
var socket = io('http://' + window.location.hostname + ':41338');
var socket = io('http://' + window.location.hostname + ':{{port}}');
var defaultSpan = 0;
var spans = [];
......
(function () {
'use strict';
const fs = require('fs');
const path = require('path');
const os = require('os');
const onHeaders = require('on-headers');
......@@ -81,6 +82,16 @@
const io = require('socket.io')(config.socketPort);
fs.readFile(path.join(__dirname, 'index.html'), 'utf8', (err,data) => {
if (err) throw new Error(err);
var result = data.replace(/{{port}}/g, config.socketPort);
fs.writeFile(path.join(__dirname, 'index.rendered.html'), result, 'utf8', (err) => {
if (err) throw new Error(err);
});
});
io.on('connection', (socket) => {
socket.emit('start', config.spans);
......@@ -96,7 +107,7 @@
return (req, res, next) => {
const startTime = process.hrtime();
if (req.path === config.path) {
res.sendFile(path.join(__dirname + '/index.html'));
res.sendFile(path.join(__dirname + '/index.rendered.html'));
} else {
onHeaders(res, () => {
const diff = process.hrtime(startTime);
......
{
"name": "express-status-monitor",
"version": "0.0.5",
"version": "0.0.6",
"description": "Monitoring for Express-based Node applications",
"main": "app.js",
"keywords": [
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!