app.get('/tracking.jpg', function(request, response) { | |
// Lấy id từ cookie và ghi log như bình thường | |
const userId = request.cookies.id; | |
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