const router = require('express-promise-router')() const db = require('../db') router.get('/:uuid/:size', async (req, res) => { const image = await db.item.getImage(req.params.uuid, req.params.size) res.set('Content-Type', image.mime_type) res.end(image.file) }) router.post('/:uuid/featured', async (req, res) => { const item = await db.item.setFeatured(req.params.uuid) res.json(item) }) router.delete('/:uuid', async (req, res) => { const item = await db.item.removeImage(req.params.uuid) res.json(item) }) module.exports = router