helpers.js 309 B

123456789101112
  1. /*
  2. Helper methods for use in the other modules.
  3. */
  4. module.exports.formatResponse = function (obj, req, res) {
  5. res.header("Content-Type", 'application/json');
  6. if (req.query && req.query.f && req.query.f == 'pjson')
  7. res.send(JSON.stringify(obj, null, 4));
  8. else
  9. res.send(obj);
  10. }