-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathrouter.js
20 lines (17 loc) · 963 Bytes
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const express = require("express")
const router = express.Router()
const petController = require("./controllers/petController")
// main routes
router.get("/", petController.homepage)
router.get("/admin", petController.adminPage)
router.post("/login", petController.loginAttempt)
router.get("/admin/logout", petController.logout)
router.get("/get-signature", petController.onlyAdmin, petController.getSignature)
// crud routes
router.get("/admin/create-pet", petController.onlyAdmin, petController.createPetPage)
router.post("/store-pet", petController.onlyAdmin, petController.storePet)
router.get("/admin/edit-pet/:id", petController.onlyAdmin, petController.editPage)
router.post("/admin/edit-pet", petController.onlyAdmin, petController.actuallyUpdatePet)
router.post("/admin/delete-pet", petController.onlyAdmin, petController.deletePet)
router.post("/admin/delete-pet-async", petController.onlyAdmin, petController.deletePetAsync)
module.exports = router