bitstream/routes/images.js

28 lines
668 B
JavaScript

// images.js
const express = require('express');
const router = express.Router();
const imageService = require('../docker/imageService');
// List images
router.get('/', async (req, res) => {
try {
const images = await imageService.listImages();
res.json(images);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch images' });
}
});
// Pull image
router.post('/pull', async (req, res) => {
try {
const { image } = req.body;
await imageService.pullImage(image);
res.json({ message: 'Image pull started' });
} catch (error) {
res.status(500).json({ error: 'Failed to pull image' });
}
});
module.exports = router;