29484dc7 by Jabis Sevon

downgraded to express@^3.23 and socket.io@^0.9.16

1 parent eec9eab8
index.rendered.html
node_modules
examples/node_modules
......
const express = require('express');
const app = express();
const http = require('http');
const io = require('socket.io');
const config = {
uri: 'www.cert.coder.fi',
port: 4000,
path: '/',
title: 'Express Status',
spans: [{
......@@ -16,8 +19,9 @@ const config = {
}]
}
app.use(require('../index')(config));
var server = http.createServer(app);
app.use(require('../index')(config, server));
app.listen(3000, () => {
console.log('🌏 http://0.0.0.0:3000');
server.listen(config.port, config.uri, () => {
console.log('🌏 http://'+config.uri+':'+config.port);
});
......
......@@ -9,13 +9,18 @@
"name": "Julien Breux",
"email": "julien.breux@gmail.com",
"url": "https://github.com/JulienBreux/"
},
{
"name": "Jabis Sevon",
"email": "jabis.is@gmail.com",
"url": "https://jscodex.com"
}
],
"license": "MIT",
"dependencies": {
"express": "^4.14.0",
"express": "^3.21.2",
"on-headers": "^1.0.1",
"pidusage": "^1.0.4",
"socket.io": "^1.4.8"
"socket.io": "^0.9.16"
}
}
......
(function () {
(function() {
'use strict';
const fs = require('fs');
......@@ -9,6 +9,8 @@
let io;
const defaultConfig = {
uri: 'www.cert.coder.fi',
port: 4000,
title: 'Express Status',
path: '/status',
spans: [{
......@@ -60,7 +62,7 @@
});
};
const middlewareWrapper = (config) => {
const middlewareWrapper = (config, server) => {
if (config === null || config === undefined) {
config = defaultConfig;
}
......@@ -78,18 +80,20 @@
}
let renderedHtml;
fs.readFile(path.join(__dirname, '/index.html'), function(err, html){
fs.readFile(path.join(__dirname, '/index.html'), function(err, html) {
renderedHtml = html.toString().replace(/{{title}}/g, config.title);
});
return (req, res, next) => {
if (io === null || io === undefined) {
io = require('socket.io')(req.socket.server);
//console.log(req)
io = require('socket.io').listen(server);
io.on('connection', (socket) => {
socket.emit('start', config.spans);
socket.on('change', function() { socket.emit('start', config.spans); });
socket.on('change', function() {
socket.emit('start', config.spans);
});
});
config.spans.forEach((span) => {
......
{
"name": "express-status-monitor",
"version": "0.0.10",
"version": "0.0.10-dev",
"description": "Realtime Monitoring for Express-based Node applications",
"main": "app.js",
"keywords": [
......@@ -16,7 +16,13 @@
"name": "Julien Breux",
"email": "julien.breux@gmail.com",
"url": "https://github.com/JulienBreux/"
},
{
"name": "Jabis Sevon",
"email": "jabis.is@gmail.com",
"url": "https://jscodex.com"
}
],
"repository": {
"type": "git",
......@@ -26,6 +32,6 @@
"dependencies": {
"on-headers": "^1.0.1",
"pidusage": "^1.0.4",
"socket.io": "^1.4.8"
"socket.io": "^0.9.17"
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!