@arisan/data-api
Version:
The Universal Database API Gateway for CLIO's Modules
30 lines (26 loc) • 954 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = checkStreamIndex;
var _DataAPI = require('../DataAPI');
//endregion
function checkStreamIndex(req, res, next) {
const log = (lvl, msg) => _DataAPI.logger.log(lvl, msg, { tags: 'checkStreamIndex' });
log('debug', JSON.stringify(req.params, null, 2));
const index = req.params.index;
if (!index) {
const message = 'No Stream Index';
log('error', message);
res.status(400).send(message);
return;
}
if (!Number.isInteger(Number(index)) || Number(index) < 0) {
const message = `Invalid Stream Index ${ index }`;
log('error', message);
res.status(400).send(message);
return;
}
next();
} //region 2. Project Libraries
//# sourceMappingURL=checkStreamIndex.js.map