2017-01-15 01:36:24 +00:00
|
|
|
const config = require('../config.js')
|
|
|
|
const routes = require('express').Router()
|
|
|
|
const uploadController = require('../controllers/uploadController')
|
2017-01-17 21:55:35 +00:00
|
|
|
const albumsController = require('../controllers/albumsController')
|
2017-01-17 19:54:25 +00:00
|
|
|
const tokenController = require('../controllers/tokenController')
|
2017-01-29 07:20:25 +00:00
|
|
|
const authController = require('../controllers/authController')
|
2017-01-15 01:36:24 +00:00
|
|
|
|
2017-01-16 07:21:46 +00:00
|
|
|
routes.get ('/check', (req, res, next) => {
|
2017-01-17 22:35:18 +00:00
|
|
|
return res.json({
|
|
|
|
private: config.private,
|
2017-01-18 23:38:13 +00:00
|
|
|
maxFileSize: config.uploads.maxSize
|
2017-01-17 22:35:18 +00:00
|
|
|
})
|
2017-01-17 03:37:54 +00:00
|
|
|
})
|
|
|
|
|
2017-01-29 07:20:25 +00:00
|
|
|
routes.post ('/login', (req, res, next) => authController.verify(req, res, next))
|
|
|
|
routes.post ('/register', (req, res, next) => authController.register(req, res, next))
|
2017-01-30 08:43:15 +00:00
|
|
|
routes.post ('/password/change', (req, res, next) => authController.changePassword(req, res, next))
|
2017-01-29 07:20:25 +00:00
|
|
|
|
2017-01-16 07:21:46 +00:00
|
|
|
routes.get ('/uploads', (req, res, next) => uploadController.list(req, res))
|
2017-01-21 08:17:29 +00:00
|
|
|
routes.get ('/uploads/:page', (req, res, next) => uploadController.list(req, res))
|
2017-01-16 07:21:46 +00:00
|
|
|
routes.post ('/upload', (req, res, next) => uploadController.upload(req, res, next))
|
2017-01-20 06:28:26 +00:00
|
|
|
routes.post ('/upload/delete', (req, res, next) => uploadController.delete(req, res, next))
|
2017-01-19 06:04:22 +00:00
|
|
|
routes.post ('/upload/:albumid', (req, res, next) => uploadController.upload(req, res, next))
|
2017-01-19 05:37:35 +00:00
|
|
|
|
|
|
|
routes.get ('/album/:id', (req, res, next) => uploadController.list(req, res, next))
|
2017-01-21 08:17:29 +00:00
|
|
|
routes.get ('/album/:id/:page', (req, res, next) => uploadController.list(req, res, next))
|
|
|
|
|
2017-01-17 21:55:35 +00:00
|
|
|
routes.get ('/albums', (req, res, next) => albumsController.list(req, res, next))
|
2017-01-19 05:37:35 +00:00
|
|
|
routes.get ('/albums/:sidebar', (req, res, next) => albumsController.list(req, res, next))
|
2017-01-18 05:40:14 +00:00
|
|
|
routes.post ('/albums', (req, res, next) => albumsController.create(req, res, next))
|
2017-01-20 06:28:26 +00:00
|
|
|
routes.post ('/albums/delete', (req, res, next) => albumsController.delete(req, res, next))
|
|
|
|
routes.post ('/albums/rename', (req, res, next) => albumsController.rename(req, res, next))
|
2017-01-17 21:55:35 +00:00
|
|
|
routes.get ('/albums/test', (req, res, next) => albumsController.test(req, res, next))
|
2017-01-19 05:37:35 +00:00
|
|
|
|
2017-01-18 07:51:42 +00:00
|
|
|
routes.get ('/tokens', (req, res, next) => tokenController.list(req, res))
|
2017-01-19 05:37:35 +00:00
|
|
|
routes.post ('/tokens/verify', (req, res, next) => tokenController.verify(req, res))
|
2017-01-18 07:51:42 +00:00
|
|
|
routes.post ('/tokens/change', (req, res, next) => tokenController.change(req, res))
|
2017-01-15 01:36:24 +00:00
|
|
|
|
2017-01-15 17:44:57 +00:00
|
|
|
module.exports = routes
|