dockerRouter.js 1.54 KB
const express = require ('express');
const router = express.Router();

const dockerController = require ('../controllers/dockerController')
const { guestOnly, memberOnly, adminOnly } =  require ('../middlewares/auth')

router.post('/dockerfile/add', memberOnly, dockerController.addDockerfile)
router.post('/dockerfile/list', memberOnly, dockerController.listDockerfile)
router.post('/dockerfile/remove', memberOnly, dockerController.removeDockerfile)
router.post('/image/list', memberOnly, dockerController.listImage)
router.post('/image/build', memberOnly, dockerController.buildImage)
router.post('/image/remove', memberOnly, dockerController.removeImage)
router.post('/container/list', memberOnly, dockerController.listContainer)
router.post('/container/create', memberOnly, dockerController.createContainer)
router.post('/container/start', memberOnly, dockerController.startContainer)
router.post('/container/stop', memberOnly, dockerController.stopContainer)
router.post('/container/remove', memberOnly, dockerController.removeContainer)

router.post('/admin/dockerfile/list', adminOnly, dockerController.adminListDockerfile)
router.post('/admin/dockerfile/remove', adminOnly, dockerController.adminDeleteDockerfile)
router.post('/admin/image/list', adminOnly, dockerController.adminListImage)
router.post('/admin/image/remove', adminOnly, dockerController.adminDeleteImage)
router.post('/admin/container/list', adminOnly, dockerController.adminListContainer)
router.post('/admin/container/remove', adminOnly, dockerController.adminDeleteContainer)

module.exports = router