Skip to content

Commit d4c85b5

Browse files
committed
Eddited notes.js
1 parent c23eef8 commit d4c85b5

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

routes/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const catchAsync = require('../utils/catchAsync');
66

77
const auth = require('../controllers/auth');
88

9-
const {isLoggedIn} = require('../middleware')
9+
const { isLoggedIn } = require('../middleware')
1010

1111
router.post('/register', catchAsync(auth.register));
1212

routes/notes.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ const catchAsync = require('../utils/catchAsync');
99

1010
const notes = require('../controllers/notes')
1111

12-
const { isLoggedIn, validateNotes } = require('../middleware')
12+
const { isLoggedIn, validateNotes } = require('../middleware');
1313

14-
router.post('/', validateNotes, catchAsync(notes.newNote));
14+
router.route('/')
15+
.post(validateNotes, catchAsync(notes.newNote))
16+
.get(isLoggedIn, catchAsync(notes.allNote))
1517

16-
router.get("/", isLoggedIn, catchAsync(notes.allNote));
17-
18-
19-
router.get('/:id', isLoggedIn, catchAsync(notes.oneNote));
20-
21-
router.put('/:id', isLoggedIn, validateNotes, catchAsync(notes.editnote));
22-
23-
router.delete('/:id', isLoggedIn, catchAsync(notes.deleteNote))
18+
router.route('/:id')
19+
.get(isLoggedIn, catchAsync(notes.oneNote))
20+
.put(isLoggedIn, validateNotes, catchAsync(notes.editnote))
21+
.delete(isLoggedIn, catchAsync(notes.deleteNote))
2422

2523
module.exports = router;

0 commit comments

Comments
 (0)