filesafe/routes/api.js

24 lines
1.1 KiB
JavaScript
Raw Normal View History

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')
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
})
routes.get ('/uploads', (req, res, next) => uploadController.list(req, res))
routes.post ('/upload', (req, res, next) => uploadController.upload(req, res, next))
2017-01-17 21:55:35 +00:00
routes.get ('/albums', (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-17 21:55:35 +00:00
routes.get ('/albums/test', (req, res, next) => albumsController.test(req, res, next))
routes.get ('/tokens/verify', (req, res, next) => tokenController.verify(req, res))
routes.get ('/tokens', (req, res, next) => tokenController.list(req, res))
routes.post ('/tokens/change', (req, res, next) => tokenController.change(req, res))
2017-01-15 17:44:57 +00:00
module.exports = routes