Skip to content

Instantly share code, notes, and snippets.



Created Aug 20, 2017
What would you like to do?
// Tracking API
app.get('/logWrite', function(request, response) {
// Lấy id người dùng thông qua cookie
const userId =;
const referrer = request.header('Referer').replace(/\/$/, "");;
const time = new Date();
const log = {userId, referrer, time};
// Ghi log vào database
db.log.insert(log, (err, result) => {
response.header('Access-Control-Allow-Origin', referrer);
response.header('Access-Control-Allow-Credentials', 'true');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment