2021-05-10 15:47:26 +00:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
2021-11-11 15:18:31 +00:00
|
|
|
|
|
|
|
// middleware
|
|
|
|
const { auth, requireAuth, upload } = require('../middleware');
|
2021-05-10 15:47:26 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
createApp,
|
2021-10-21 22:42:27 +00:00
|
|
|
getAllApps,
|
|
|
|
getSingleApp,
|
2021-05-10 15:47:26 +00:00
|
|
|
updateApp,
|
2021-06-15 14:02:57 +00:00
|
|
|
deleteApp,
|
2021-10-21 22:42:27 +00:00
|
|
|
reorderApps,
|
2021-05-10 15:47:26 +00:00
|
|
|
} = require('../controllers/apps');
|
|
|
|
|
2021-11-11 15:18:31 +00:00
|
|
|
router
|
|
|
|
.route('/')
|
|
|
|
.post(auth, requireAuth, upload, createApp)
|
|
|
|
.get(auth, getAllApps);
|
2021-05-10 15:47:26 +00:00
|
|
|
|
2021-11-11 15:01:56 +00:00
|
|
|
router
|
|
|
|
.route('/:id')
|
|
|
|
.get(auth, getSingleApp)
|
2021-11-11 15:18:31 +00:00
|
|
|
.put(auth, requireAuth, upload, updateApp)
|
|
|
|
.delete(auth, requireAuth, deleteApp);
|
2021-05-10 15:47:26 +00:00
|
|
|
|
2021-11-11 15:18:31 +00:00
|
|
|
router.route('/0/reorder').put(auth, requireAuth, reorderApps);
|
2021-06-15 14:02:57 +00:00
|
|
|
|
2021-10-21 22:42:27 +00:00
|
|
|
module.exports = router;
|