spee.ch/server/controllers/assets/serveAsset/index.js
2018-06-25 23:30:21 -07:00

17 lines
523 B
JavaScript

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);
// get the claim Id and then serve the asset
getClaimIdAndServeAsset(null, null, claimName, claimId, originalUrl, ip, res);
};
module.exports = serveAsset;