Skip to content

Instantly share code, notes, and snippets.

@rgwozdz
Created July 20, 2018 20:26
Show Gist options
  • Save rgwozdz/89b80cb0656f22cb4c71b61fe94947b9 to your computer and use it in GitHub Desktop.
Save rgwozdz/89b80cb0656f22cb4c71b61fe94947b9 to your computer and use it in GitHub Desktop.
Model.prototype.createKey = function (req) {
let key = req.url.split('/')[1]
if (req.params.host) key = `${key}::${req.params.host}`
if (req.params.id) key = `${key}::${req.params.id}`
key = (req.query.startdate && req.query.enddate) ? `${key}::${req.params.startdate}::${req.params.enddate}` : ''
return key
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment