diff options
| author | pitu <[email protected]> | 2017-01-14 22:36:24 -0300 |
|---|---|---|
| committer | pitu <[email protected]> | 2017-01-14 22:36:24 -0300 |
| commit | 91a7ec7286e1855ecebb7face35f1677a0f752e5 (patch) | |
| tree | 9fd4d6b4a26f1d7c81e131a7497eae60bc11040e /routes/api.js | |
| parent | whoops (diff) | |
| download | host.fuwn.me-91a7ec7286e1855ecebb7face35f1677a0f752e5.tar.xz host.fuwn.me-91a7ec7286e1855ecebb7face35f1677a0f752e5.zip | |
WIP admin, probably not smart to clone repo now
Diffstat (limited to 'routes/api.js')
| -rw-r--r-- | routes/api.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/routes/api.js b/routes/api.js new file mode 100644 index 0000000..23a1a60 --- /dev/null +++ b/routes/api.js @@ -0,0 +1,21 @@ +const config = require('../config.js') +const routes = require('express').Router() +const uploadController = require('../controllers/uploadController') +const galleryController = require('../controllers/galleryController') + +routes.get ('/info', (req, res, next) => { + + if(config.TOKEN !== '') + if(req.headers.auth !== config.TOKEN) + return res.status(401).send('not-authorized') + + return res.json({ + maxFileSize: config.uploads.maxsize.slice(0, -2) + }) +}) + +routes.post ('/upload', (req, res, next) => uploadController.upload(req, res, next)) +routes.get ('/gallery', (req, res, next) => galleryController.list(req, res, next)) +routes.get ('/gallery/test', (req, res, next) => galleryController.test(req, res, next)) + +module.exports = routes
\ No newline at end of file |