Skip to content

Instantly share code, notes, and snippets.



Created Aug 20, 2017
What would you like to do?
app.get('/tracking.jpg', function(request, response) {
// Lấy id từ cookie và ghi log như bình thường
const userId =;
const referrer = (request.header('Referer') || 'Empty').replace(/\/$/, "");;
const time = new Date();
const log = { userId, referrer, time };
db.log.insert(log, (err, result) => {
// Trả ra file ảnh "vô hại"
response.sendFile(__dirname + '/public/track.jpg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment