forked from WildCodeSchool/dvna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
67 lines (46 loc) · 2.22 KB
/
app.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var router = require('express').Router()
var appHandler = require('../core/appHandler')
var authHandler = require('../core/authHandler')
module.exports = function () {
router.get('/', authHandler.isAuthenticated, function (req, res) {
res.redirect('/learn')
})
router.get('/usersearch', authHandler.isAuthenticated, function (req, res) {
res.render('app/usersearch', {
output: null
})
})
router.get('/ping', authHandler.isAuthenticated, function (req, res) {
res.render('app/ping', {
output: null
})
})
router.get('/bulkproducts', authHandler.isAuthenticated, function (req, res) {
res.render('app/bulkproducts',{legacy:req.query.legacy})
})
router.get('/products', authHandler.isAuthenticated, appHandler.listProducts)
router.get('/modifyproduct', authHandler.isAuthenticated, appHandler.modifyProduct)
router.get('/useredit', authHandler.isAuthenticated, appHandler.userEdit)
router.get('/calc', authHandler.isAuthenticated, function (req, res) {
res.render('app/calc',{output:null})
})
router.get('/admin', authHandler.isAuthenticated, function (req, res) {
res.render('app/admin', {
admin: (req.user.role == 'admin')
})
})
router.get('/admin/usersapi', authHandler.isAuthenticated, appHandler.listUsersAPI)
router.get('/admin/users', authHandler.isAuthenticated, function(req, res){
res.render('app/adminusers')
})
router.get('/redirect', appHandler.redirect)
router.post('/usersearch', authHandler.isAuthenticated, appHandler.userSearch)
router.post('/ping', authHandler.isAuthenticated, appHandler.ping)
router.post('/products', authHandler.isAuthenticated, appHandler.productSearch)
router.post('/modifyproduct', authHandler.isAuthenticated, appHandler.modifyProductSubmit)
router.post('/useredit', authHandler.isAuthenticated, appHandler.userEditSubmit)
router.post('/calc', authHandler.isAuthenticated, appHandler.calc)
router.post('/bulkproducts',authHandler.isAuthenticated, appHandler.bulkProducts);
router.post('/bulkproductslegacy',authHandler.isAuthenticated, appHandler.bulkProductsLegacy);
return router
}