"use strict";

module.exports = {
    nocache: function (req, res, next) {
                    res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
                    res.header('Expires', '-1');
                    res.header('Pragma', 'no-cache');
                    return next();
    },
    sendJson: function(res, document){
        try{
            if (document) {
                res.json(document);
            } else {
                res.sendStatus(404);
            }
        }
        catch(e){
            logger.error(e.message);
        }
    }
};