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