From 702075b66dcc22bfa5e018f6a764ab23c8f9a9f5 Mon Sep 17 00:00:00 2001 From: Pitu <7425261+Pitu@users.noreply.github.com> Date: Tue, 3 Oct 2017 21:13:38 -0300 Subject: ES6 rewrite --- routes/api.js | 66 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'routes/api.js') diff --git a/routes/api.js b/routes/api.js index b3ff798..83d3bc1 100644 --- a/routes/api.js +++ b/routes/api.js @@ -1,40 +1,36 @@ -const config = require('../config.js') -const routes = require('express').Router() -const uploadController = require('../controllers/uploadController') -const albumsController = require('../controllers/albumsController') -const tokenController = require('../controllers/tokenController') -const authController = require('../controllers/authController') +const config = require('../config.js'); +const routes = require('express').Router(); +const uploadController = require('../controllers/uploadController'); +const albumsController = require('../controllers/albumsController'); +const tokenController = require('../controllers/tokenController'); +const authController = require('../controllers/authController'); -routes.get ('/check', (req, res, next) => { - return res.json({ +routes.get('/check', (req, res, next) => { + return res.json({ private: config.private, maxFileSize: config.uploads.maxSize - }) -}) + }); +}); -routes.post ('/login', (req, res, next) => authController.verify(req, res, next)) -routes.post ('/register', (req, res, next) => authController.register(req, res, next)) -routes.post ('/password/change', (req, res, next) => authController.changePassword(req, res, next)) +routes.post('/login', (req, res, next) => authController.verify(req, res, next)); +routes.post('/register', (req, res, next) => authController.register(req, res, next)); +routes.post('/password/change', (req, res, next) => authController.changePassword(req, res, next)); +routes.get('/uploads', (req, res, next) => uploadController.list(req, res, next)); +routes.get('/uploads/:page', (req, res, next) => uploadController.list(req, res, next)); +routes.post('/upload', (req, res, next) => uploadController.upload(req, res, next)); +routes.post('/upload/delete', (req, res, next) => uploadController.delete(req, res, next)); +routes.post('/upload/:albumid', (req, res, next) => uploadController.upload(req, res, next)); +routes.get('/album/get/:identifier', (req, res, next) => albumsController.get(req, res, next)); +routes.get('/album/:id', (req, res, next) => uploadController.list(req, res, next)); +routes.get('/album/:id/:page', (req, res, next) => uploadController.list(req, res, next)); +routes.get('/albums', (req, res, next) => albumsController.list(req, res, next)); +routes.get('/albums/:sidebar', (req, res, next) => albumsController.list(req, res, next)); +routes.post('/albums', (req, res, next) => albumsController.create(req, res, next)); +routes.post('/albums/delete', (req, res, next) => albumsController.delete(req, res, next)); +routes.post('/albums/rename', (req, res, next) => albumsController.rename(req, res, next)); +routes.get('/albums/test', (req, res, next) => albumsController.test(req, res, next)); +routes.get('/tokens', (req, res, next) => tokenController.list(req, res, next)); +routes.post('/tokens/verify', (req, res, next) => tokenController.verify(req, res, next)); +routes.post('/tokens/change', (req, res, next) => tokenController.change(req, res, next)); -routes.get ('/uploads', (req, res, next) => uploadController.list(req, res)) -routes.get ('/uploads/:page', (req, res, next) => uploadController.list(req, res)) -routes.post ('/upload', (req, res, next) => uploadController.upload(req, res, next)) -routes.post ('/upload/delete', (req, res, next) => uploadController.delete(req, res, next)) -routes.post ('/upload/:albumid', (req, res, next) => uploadController.upload(req, res, next)) - -routes.get ('/album/get/:identifier', (req, res, next) => albumsController.get(req, res, next)) -routes.get ('/album/:id', (req, res, next) => uploadController.list(req, res, next)) -routes.get ('/album/:id/:page', (req, res, next) => uploadController.list(req, res, next)) - -routes.get ('/albums', (req, res, next) => albumsController.list(req, res, next)) -routes.get ('/albums/:sidebar', (req, res, next) => albumsController.list(req, res, next)) -routes.post ('/albums', (req, res, next) => albumsController.create(req, res, next)) -routes.post ('/albums/delete', (req, res, next) => albumsController.delete(req, res, next)) -routes.post ('/albums/rename', (req, res, next) => albumsController.rename(req, res, next)) -routes.get ('/albums/test', (req, res, next) => albumsController.test(req, res, next)) - -routes.get ('/tokens', (req, res, next) => tokenController.list(req, res)) -routes.post ('/tokens/verify', (req, res, next) => tokenController.verify(req, res)) -routes.post ('/tokens/change', (req, res, next) => tokenController.change(req, res)) - -module.exports = routes +module.exports = routes; -- cgit v1.2.3