all files / lib/middleware/ checkPort.js

50% Statements 9/18
66.67% Branches 4/6
100% Functions 1/1
52.94% Lines 9/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                       
'use strict';
 
Object.defineProperty(exports, "__esModule", {
        value: true
});
exports.default = checkPort;
 
var _DataAPI = require('../DataAPI');
 
//endregion
 
function checkPort(req, res, next) {
        const log = (lvl, msg) => _DataAPI.logger.log(lvl, msg, { tags: 'checkPort' });
        const port = parseInt(req.body.port, 10);
        Iif (!port) {
                const message = 'No Port';
                log('error', message);
                res.status(400).send(message);
                return;
        }
        Iif (port < 1 || port > 65535) {
                const message = `Port in Invalid Range ${ port }`;
                log('error', message);
                res.status(400).send(message);
                return;
        }
        next();
} //region 2. Project Libraries
//# sourceMappingURL=checkPort.js.map