summaryrefslogtreecommitdiffstats
path: root/server/router.js
diff options
context:
space:
mode:
authorJannik Schönartz2019-02-22 03:18:37 +0100
committerJannik Schönartz2019-02-22 03:18:37 +0100
commit99d55d2fbcad1e04b0a0b672913584ccf198e70a (patch)
tree52631fcf9831abb2a295494ceb51b27534da7ef2 /server/router.js
parent[users] Move user based calls from the authentication to the users api (diff)
downloadbas-99d55d2fbcad1e04b0a0b672913584ccf198e70a.tar.gz
bas-99d55d2fbcad1e04b0a0b672913584ccf198e70a.tar.xz
bas-99d55d2fbcad1e04b0a0b672913584ccf198e70a.zip
[router] All modules have the new api style, deleted old unnecessary code
Diffstat (limited to 'server/router.js')
-rw-r--r--server/router.js24
1 files changed, 0 insertions, 24 deletions
diff --git a/server/router.js b/server/router.js
index b00f164..4aa7e54 100644
--- a/server/router.js
+++ b/server/router.js
@@ -14,30 +14,6 @@ fs.readdirSync(path.join(__dirname, 'api')).forEach(filename => {
if (api.router) router.use('/' + filename.split('.')[0] + '/', auth.verifyToken, permUtil.exportFunctions, api.router)
})
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// !!!!!!!! TODO: DELETE IF ALL MODULES ARE REWORKED WITH exports.router !!!!!!!
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-// Dynamic API routes
-function mapApi (method) {
- return function (req, res) {
- var api = require(path.join(__dirname, 'api', req.params.api))
- if (method in api && req.params.action in api[method]) {
- api[method][req.params.action](req, res)
- } else {
- res.status(501).end()
- }
- }
-}
-
-// Every API can be called with /<api>/<action>
-router.get('/:api/:action', auth.verifyToken, mapApi('get'))
-router.post('/:api/:action', auth.verifyToken, mapApi('post'))
-
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
router.use('*', (req, res) => {
res.status(404).end()
})