const logger = require('winston'); // const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); module.exports = { serveFile ({ filePath, fileType }, claimId, name, res) { logger.verbose(`serving ${name}#${claimId}`); // set response options const headerContentType = fileType || 'image/jpeg'; const options = { headers: { 'X-Content-Type-Options': 'nosniff', 'Content-Type' : headerContentType, }, }; // send the file if (filePath) { res.status(200).sendFile(filePath, options); } else { // res.status(307).redirect(`/api/get/${name}/${claimId}`); res.status(400).json({success: false, message: 'that claim is not hosted locally by Spee