diff --git a/src/app.js b/src/app.js index 6ebb5aa..4dd3bec 100644 --- a/src/app.js +++ b/src/app.js @@ -111,7 +111,7 @@ app.get('/', (req, res) => { }); // Error handler -app.use((err, req, res, next) => { +app.use((err, req, res, _next) => { console.error('💥 Error:', err); res.status(500).json({ error: err.message }); }); @@ -136,4 +136,4 @@ if (require.main === module) { }); } -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/src/middleware/logger.js b/src/middleware/logger.js index 9d3b339..7d1d6e0 100644 --- a/src/middleware/logger.js +++ b/src/middleware/logger.js @@ -15,7 +15,7 @@ function logger(req, res, next) { // Override res.end to capture response time and status const originalEnd = res.end; - res.end = function (chunk, encoding) { + res.end = function(chunk, encoding) { const responseTime = Date.now() - startTime; // Record response time histogram @@ -40,4 +40,4 @@ function logger(req, res, next) { next(); } -module.exports = logger; \ No newline at end of file +module.exports = logger; diff --git a/src/public/app.js b/src/public/app.js index c6dcec5..e647e41 100644 --- a/src/public/app.js +++ b/src/public/app.js @@ -220,7 +220,7 @@ class MonitoringDashboard { const container = document.getElementById('api-metrics'); const requestCounters = data.counters.filter(c => c.name === 'http_requests_total'); - const responseCounters = data.counters.filter(c => c.name === 'http_responses_total'); + // const _responseCounters = data.counters.filter(c => c.name === 'http_responses_total'); const durationHistograms = data.histograms.filter(h => h.name === 'http_request_duration_ms'); let html = '
'; @@ -303,7 +303,7 @@ class MonitoringDashboard { updateStatus(status, text) { const indicator = document.getElementById('status-indicator'); - const dot = document.getElementById('status-dot'); + // const _dot = document.getElementById('status-dot'); const statusText = document.getElementById('status-text'); indicator.className = `status-indicator ${status}`; @@ -367,6 +367,7 @@ class MonitoringDashboard { } // Global functions for buttons +// eslint-disable-next-line no-unused-vars async function refreshData() { const dashboard = window.dashboard; if (dashboard) { @@ -374,6 +375,7 @@ async function refreshData() { } } +// eslint-disable-next-line no-unused-vars async function testAPI() { try { const response = await fetch('/api/test'); @@ -392,6 +394,7 @@ async function testAPI() { } } +// eslint-disable-next-line no-unused-vars async function downloadMetrics() { try { const response = await fetch('/api/metrics'); @@ -419,4 +422,4 @@ async function downloadMetrics() { // Initialize dashboard when page loads document.addEventListener('DOMContentLoaded', () => { window.dashboard = new MonitoringDashboard(); -}); \ No newline at end of file +}); diff --git a/src/routes/api.js b/src/routes/api.js index 9050081..af8d472 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -136,4 +136,4 @@ router.get('/test', (req, res) => { }); }); -module.exports = router; \ No newline at end of file +module.exports = router; diff --git a/src/routes/health.js b/src/routes/health.js index 1032326..ec8e974 100644 --- a/src/routes/health.js +++ b/src/routes/health.js @@ -90,4 +90,4 @@ router.get('/live', (req, res) => { }); }); -module.exports = router; \ No newline at end of file +module.exports = router; diff --git a/src/utils/metrics.js b/src/utils/metrics.js index 1140bf0..a6a0a2d 100644 --- a/src/utils/metrics.js +++ b/src/utils/metrics.js @@ -92,4 +92,4 @@ module.exports = { recordHistogram, getMetrics, resetMetrics -}; \ No newline at end of file +}; diff --git a/tests/api.tests.js b/tests/api.tests.js index fde2ecd..46398cb 100644 --- a/tests/api.tests.js +++ b/tests/api.tests.js @@ -3,7 +3,7 @@ const app = require('../src/app'); describe('API Endpoints', () => { describe('GET /api/system', () => { - it('should return system information', async () => { + it('should return system information', async() => { const response = await request(app) .get('/api/system') .expect(200); @@ -18,7 +18,7 @@ describe('API Endpoints', () => { }); describe('GET /api/memory', () => { - it('should return memory information', async () => { + it('should return memory information', async() => { const response = await request(app) .get('/api/memory') .expect(200); @@ -33,7 +33,7 @@ describe('API Endpoints', () => { }); describe('GET /api/process', () => { - it('should return process information', async () => { + it('should return process information', async() => { const response = await request(app) .get('/api/process') .expect(200); @@ -47,7 +47,7 @@ describe('API Endpoints', () => { }); describe('GET /api/metrics', () => { - it('should return application metrics', async () => { + it('should return application metrics', async() => { const response = await request(app) .get('/api/metrics') .expect(200); @@ -62,7 +62,7 @@ describe('API Endpoints', () => { }); describe('GET /api/test', () => { - it('should return test response', async () => { + it('should return test response', async() => { const response = await request(app) .get('/api/test') .expect(200); @@ -75,7 +75,7 @@ describe('API Endpoints', () => { }); describe('Error handling', () => { - it('should return 404 for unknown API endpoints', async () => { + it('should return 404 for unknown API endpoints', async() => { const response = await request(app) .get('/api/nonexistent') .expect(404); @@ -84,4 +84,4 @@ describe('API Endpoints', () => { expect(response.body.error).toBe('Not Found'); }); }); -}); \ No newline at end of file +}); diff --git a/tests/health.tests.js b/tests/health.tests.js index 640c188..c597d80 100644 --- a/tests/health.tests.js +++ b/tests/health.tests.js @@ -3,7 +3,7 @@ const app = require('../src/app'); describe('Health Check Endpoints', () => { describe('GET /health', () => { - it('should return basic health status', async () => { + it('should return basic health status', async() => { const response = await request(app) .get('/health') .expect(200); @@ -17,7 +17,7 @@ describe('Health Check Endpoints', () => { }); describe('GET /health/detailed', () => { - it('should return detailed health information', async () => { + it('should return detailed health information', async() => { const response = await request(app) .get('/health/detailed') .expect(200); @@ -49,7 +49,7 @@ describe('Health Check Endpoints', () => { expect(response.body.loadAverage).toHaveLength(3); }); - it('should include version information', async () => { + it('should include version information', async() => { const response = await request(app) .get('/health/detailed') .expect(200); @@ -59,7 +59,7 @@ describe('Health Check Endpoints', () => { }); describe('GET /health/ready', () => { - it('should return readiness status', async () => { + it('should return readiness status', async() => { const response = await request(app) .get('/health/ready') .expect(200); @@ -70,7 +70,7 @@ describe('Health Check Endpoints', () => { }); describe('GET /health/live', () => { - it('should return liveness status', async () => { + it('should return liveness status', async() => { const response = await request(app) .get('/health/live') .expect(200); @@ -83,7 +83,7 @@ describe('Health Check Endpoints', () => { }); describe('Health status validation', () => { - it('should return valid timestamp format', async () => { + it('should return valid timestamp format', async() => { const response = await request(app) .get('/health') .expect(200); @@ -93,11 +93,11 @@ describe('Health Check Endpoints', () => { expect(timestamp.getTime()).not.toBeNaN(); }); - it('should return consistent service name across endpoints', async () => { + it('should return consistent service name across endpoints', async() => { const basicHealth = await request(app).get('/health'); const detailedHealth = await request(app).get('/health/detailed'); expect(basicHealth.body.service).toBe(detailedHealth.body.service); }); }); -}); \ No newline at end of file +});