24 lines
825 B
JavaScript
24 lines
825 B
JavaScript
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
|
|
res.status(200).sendFile(filePath, options);
|
|
},
|
|
showFile (claimInfo, shortId, res) {
|
|
res.status(200).render('show', { layout: 'show', claimInfo, shortId });
|
|
},
|
|
showFileLite (claimInfo, shortId, res) {
|
|
res.status(200).render('showLite', { layout: 'showlite', claimInfo, shortId });
|
|
},
|
|
};
|