const { Router } = require('express');
const { endpoints, UPLOAD_FS_DIR } = require('../constants');
const path = require('path');

const router = Router();

router.get(endpoints.DOWNLOAD_FILE, (req, res) => {
    const filePath = path.join(__dirname, '..', UPLOAD_FS_DIR, req.params.id);
    res.download(filePath);
});

module.exports = router;
