AppReports/lib/api/get-log.js
2020-08-16 11:48:06 +02:00

19 lines
416 B
JavaScript

'use strict';
const db = require ('../db');
const { http } = require ('@sapphirecode/consts');
module.exports = async (req, res) => {
if (
typeof req.headers.app_id === 'undefined'
|| isNaN (parseInt (req.headers.app_id))
) {
res.status (http.status_bad_request)
.end ();
}
else {
res.status (http.status_ok)
.json (await db.log.get_all (parseInt (req.headers.app_id)));
}
};