-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c115f5d
commit 6913751
Showing
4 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { response } = require('express'); | ||
|
||
const getEvents = ( req, res = response ) => { | ||
|
||
res.json({ | ||
ok: true, | ||
msg: "Get Events" | ||
}) | ||
} | ||
|
||
const createEvent = ( req, res = response ) => { | ||
|
||
res.json({ | ||
ok: true, | ||
msg: "Create Event" | ||
}) | ||
} | ||
|
||
const updateEvent = ( req, res = response ) => { | ||
|
||
res.json({ | ||
ok: true, | ||
msg: "Update Event" | ||
}) | ||
} | ||
|
||
const deleteEvent = ( req, res = response ) => { | ||
|
||
res.json({ | ||
ok: true, | ||
msg: "Delete Event" | ||
}) | ||
} | ||
|
||
|
||
module.exports = { | ||
getEvents, | ||
updateEvent, | ||
deleteEvent, | ||
createEvent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Events Routes / Events | ||
host + /api/events | ||
*/ | ||
const { Router } = require("express"); | ||
const { getEvents, createEvent, updateEvent, deleteEvent } = require('../controllers/events') | ||
const { validJWT } = require('../middlewares/jwt-validator'); | ||
|
||
|
||
const router = Router(); | ||
|
||
// Get events | ||
router.get('/', validJWT, getEvents); | ||
|
||
// Create Event | ||
router.post('/', validJWT, createEvent); | ||
|
||
// Update Event | ||
router.put('/:id', validJWT, updateEvent); | ||
|
||
// Delete Event | ||
router.delete('/:id', validJWT, deleteEvent); | ||
|
||
|
||
|
||
module.exports = router; | ||
|