mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 11:39:36 +02:00
Backend: auth for config and queries. Refactor of middleware exports
This commit is contained in:
parent
e3f167921c
commit
22471d64c7
10 changed files with 43 additions and 31 deletions
|
@ -1,7 +1,8 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const upload = require('../middleware/multer');
|
||||
const auth = require('../middleware/auth');
|
||||
|
||||
// middleware
|
||||
const { auth, requireAuth, upload } = require('../middleware');
|
||||
|
||||
const {
|
||||
createApp,
|
||||
|
@ -12,14 +13,17 @@ const {
|
|||
reorderApps,
|
||||
} = require('../controllers/apps');
|
||||
|
||||
router.route('/').post(auth, upload, createApp).get(auth, getAllApps);
|
||||
router
|
||||
.route('/')
|
||||
.post(auth, requireAuth, upload, createApp)
|
||||
.get(auth, getAllApps);
|
||||
|
||||
router
|
||||
.route('/:id')
|
||||
.get(auth, getSingleApp)
|
||||
.put(auth, upload, updateApp)
|
||||
.delete(auth, deleteApp);
|
||||
.put(auth, requireAuth, upload, updateApp)
|
||||
.delete(auth, requireAuth, deleteApp);
|
||||
|
||||
router.route('/0/reorder').put(auth, reorderApps);
|
||||
router.route('/0/reorder').put(auth, requireAuth, reorderApps);
|
||||
|
||||
module.exports = router;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue