forked from ParksDivision/Green-Report-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
executable file
·39 lines (26 loc) · 941 Bytes
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -- This lives in our routes.js --
'use strict';
//const express = require('express');
const router = require('express').Router();
const {
sendUnconfirmedReports,
saveNewReport,
deleteNewReport,
approveNewReport
} = require('./controllers/unverifiedReports');
const {
getCategories,
getSingleCategory
} = require('./controllers/categories');
const { isSuperUser } = require('./controllers/checkAdminStatus');
const { searchReports } = require('./controllers/searchReports');
// Verify if the user has admin permissions
router.post('/authorise', isSuperUser);
router.get('/categories', getCategories);
router.get('/categories/:categoryName', getSingleCategory);
router.post('/newReport', saveNewReport);
router.get('/newReport', sendUnconfirmedReports);
router.post('/deleteReport', deleteNewReport);
router.post('/approveReport', approveNewReport);
router.post('/search', searchReports);
module.exports = router;