spee.ch/server/controllers/assets/serveAsset/index.js

18 lines
523 B
JavaScript
Raw Normal View History

2018-06-26 03:42:30 +02:00
const { sendGAServeEvent } = require('../../../utils/googleAnalytics');
const getClaimIdAndServeAsset = require('../utils/getClaimIdAndServeAsset.js');
/*
route to serve an asset directly
*/
const serveAsset = ({ headers, ip, originalUrl, params: { claimName, claimId } }, res) => {
// send google analytics
sendGAServeEvent(headers, ip, originalUrl);
2018-06-26 03:51:54 +02:00
// get the claim Id and then serve the asset
2018-06-26 03:42:30 +02:00
getClaimIdAndServeAsset(null, null, claimName, claimId, originalUrl, ip, res);
};
module.exports = serveAsset;