lecoffre_node/web/status/working-api.js

53 lines
3.2 KiB
JavaScript

#!/usr/bin/env node
const express = require('express');
const app = express();
const PORT = 3006;
// Middleware CORS
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
next();
});
// Route de test simple - données statiques
app.get('/api', (req, res) => {
const services = [
{ name: 'Bitcoin Signet', status: 'running', image: 'btcpayserver/bitcoin:27.1', ip: '172.20.0.2', port: '8332', protocol: 'RPC', uptime: '2h 15m', health: 'healthy' },
{ name: 'BlindBit Oracle', status: 'running', image: 'blindbit/oracle:latest', ip: '172.20.0.3', port: '8000', protocol: 'HTTP', uptime: '2h 10m', health: 'healthy' },
{ name: 'SDK Relay', status: 'running', image: 'sdk_relay:ext', ip: '172.20.0.4', port: '8090', protocol: 'WebSocket', uptime: '2h 5m', health: 'healthy' },
{ name: 'SDK Storage', status: 'running', image: 'sdk_storage:ext', ip: '172.20.0.6', port: '8080', protocol: 'HTTP', uptime: '1h 55m', health: 'healthy' },
{ name: 'LeCoffre Frontend', status: 'running', image: 'lecoffre-front:ext', ip: '172.20.0.8', port: '3000', protocol: 'HTTP', uptime: '1h 45m', health: 'healthy' },
{ name: 'IHM Client', status: 'running', image: 'ihm_client:ext', ip: '172.20.0.9', port: '3001', protocol: 'HTTP', uptime: '1h 40m', health: 'healthy' },
{ name: 'Tor Proxy', status: 'running', image: 'btcpayserver/tor:0.4.8.10', ip: '172.20.0.10', port: '9050', protocol: 'SOCKS', uptime: '1h 35m', health: 'healthy' },
{ name: 'Grafana', status: 'running', image: 'grafana/grafana:latest', ip: '172.20.0.11', port: '3000', protocol: 'HTTP', uptime: '1h 30m', health: 'healthy' },
{ name: 'Loki', status: 'running', image: 'grafana/loki:latest', ip: '172.20.0.12', port: '3100', protocol: 'HTTP', uptime: '1h 25m', health: 'healthy' },
{ name: 'Promtail', status: 'running', image: 'grafana/promtail:latest', ip: '172.20.0.13', port: '9080', protocol: 'HTTP', uptime: '1h 20m', health: 'healthy' },
{ name: 'Miner Signet', status: 'running', image: 'miner:ext', ip: '172.20.0.14', port: null, protocol: 'Bitcoin', uptime: '1h 15m', health: 'healthy' }
];
const external = [
{ name: 'Mempool Signet', url: 'https://mempool2.4nkweb.com', protocol: 'HTTPS', status: 'running', response_time: '120ms' },
{ name: 'Relay Bootstrap', url: 'wss://dev3.4nkweb.com/ws/', protocol: 'WebSocket', status: 'running', response_time: 'N/A (WebSocket)' },
{ name: 'Signer Bootstrap', url: 'https://dev3.4nkweb.com', protocol: 'HTTPS', status: 'running', response_time: '80ms' },
{ name: 'Git Repository', url: 'git.4nkweb.com', protocol: 'SSH', status: 'running', response_time: 'N/A (SSH)' }
];
res.json({
timestamp: new Date().toISOString(),
services: services,
external: external
});
});
app.get('/health', (req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`🚀 API Status Working démarrée sur http://0.0.0.0:${PORT}`);
});
module.exports = app;