File size: 721 Bytes
0dd2082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const cache = require('../services/cache.service');
const orchestrator = require('../services/orchestrator.service');
const { success } = require('../utils/response');

async function getHealth(req, res, next) {
    try {
        const providers = await orchestrator.healthCheck();

        success(res, {
            status: 'online',
            version: '1.0.0',
            providers,
        });
    } catch (err) {
        next(err);
    }
}

function getCacheStats(req, res) {
    success(res, {
        cache: cache.getStats(),
    });
}

function clearCache(req, res) {
    cache.clear();
    success(res, { message: 'Cache cleared successfully' });
}

module.exports = { getHealth, getCacheStats, clearCache };