backend ported to node.js (work in progress)

This commit is contained in:
azivner
2017-10-14 23:31:44 -04:00
parent 14acacf2e9
commit cc3a621324
26 changed files with 2118 additions and 0 deletions

18
node/routes/audit.js Normal file
View File

@@ -0,0 +1,18 @@
const express = require('express');
const router = express.Router();
const sql = require('../sql');
router.get('/:full_load_time', async (req, res, next) => {
const fullLoadTime = req.params.full_load_time;
const browserId = req.get('x-browser-id');
const count = await sql.getSingleResult("SELECT COUNT(*) AS 'count' FROM audit_log WHERE browser_id != ? " +
"AND date_modified >= ?", [browserId, fullLoadTime])['count'];
res.send({
'changed': count > 0
});
});
module.exports = router;