44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
const express = require('express');
|
|
const { protect } = require('../middleware/auth');
|
|
const streamPipesService = require('../services/streamPipesService');
|
|
const logger = require('../utils/logger');
|
|
|
|
const router = express.Router();
|
|
|
|
// Get StreamPipes health status
|
|
router.get('/health', protect, async (req, res) => {
|
|
try {
|
|
const health = await streamPipesService.healthCheck();
|
|
|
|
res.json({
|
|
success: true,
|
|
data: health
|
|
});
|
|
} catch (error) {
|
|
logger.error('StreamPipes health check error:', error);
|
|
res.status(500).json({
|
|
success: false,
|
|
message: 'Failed to check StreamPipes health'
|
|
});
|
|
}
|
|
});
|
|
|
|
// Get data streams
|
|
router.get('/streams', protect, async (req, res) => {
|
|
try {
|
|
const streams = await streamPipesService.getDataStreams();
|
|
|
|
res.json({
|
|
success: true,
|
|
data: streams
|
|
});
|
|
} catch (error) {
|
|
logger.error('Get StreamPipes streams error:', error);
|
|
res.status(500).json({
|
|
success: false,
|
|
message: 'Failed to get data streams'
|
|
});
|
|
}
|
|
});
|
|
|
|
module.exports = router;
|