Skip to content

Instantly share code, notes, and snippets.

@makefunstuff
Created March 4, 2017 23:30
Show Gist options
  • Save makefunstuff/f5e2915d190c19ef1b057e0fce1d72fd to your computer and use it in GitHub Desktop.
Save makefunstuff/f5e2915d190c19ef1b057e0fce1d72fd to your computer and use it in GitHub Desktop.
app.get('/data/:entry_id', (req, res, next) => {
const { entry_id } = req.params;
database.getById(id)
.then((data) => {
logger('[INFO] data is received');
tracking('data.received', {id: id});
return res.json(data);
})
.catch(next);
});
app.get('/data/:entry_id/filtered', (req, res, next) => {
const { entry_id } = req.params;
database.getById(id)
.then((data) => dataFilterService({id: data}))
.then((apiResult) => {
logger('[INFO] data is filtered');
tracking('api.result.received');
res.json(apiResult);
})
.catch(next);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment