All checks were successful
the-tip-top-backend/pipeline/head This commit looks good
25 lines
608 B
JavaScript
25 lines
608 B
JavaScript
import express from 'express';
|
|
import client from 'prom-client';
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 4000;
|
|
|
|
// Crée un registre de métriques Prometheus
|
|
const register = new client.Registry();
|
|
client.collectDefaultMetrics({ register });
|
|
|
|
// Route API
|
|
app.get('/', (req, res) => {
|
|
res.send('The Tip Top Backend is running 🚀');
|
|
});
|
|
|
|
// Route /metrics pour Prometheus
|
|
app.get('/metrics', async (req, res) => {
|
|
res.set('Content-Type', register.contentType);
|
|
res.end(await register.metrics());
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`✅ Backend running on port ${PORT}`);
|
|
});
|