galleryController.js 367 B

12345678910111213
  1. const config = require('../config.js')
  2. const db = require('knex')(config.database)
  3. let galleryController = {}
  4. galleryController.list = function(req, res, next){
  5. if(!config.privacy.public)
  6. if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
  7. db.table('gallery').select('id', 'name').then((data) => {
  8. res.json({ data })
  9. })
  10. }