Guest User

Untitled

a guest
Feb 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. exports.getData = (req, res) => {
  2. res.setHeader('Content-Type', 'application/json');
  3. res.set('Access-Control-Allow-Origin', "*")
  4. res.set('Access-Control-Allow-Methods', 'GET, POST')
  5. console.log("The function data -->");
  6. var data = {};
  7. data.query = req.query;
  8. data.params = req.params;
  9. data.body = req.body;
  10. data.method = req.method;
  11. data.contenttype = req.get('content-type');
  12. data.app = req.query;
  13. data.baseUrl = req.baseUrl;
  14. data.cookies = req.cookies;
  15. data.fresh = req.fresh;
  16. data.hostname = req.hostname;
  17. data.ip = req.ip;
  18. data.originalUrl = req.originalUrl;
  19. data.params[0] = req.params[0];
  20. data.path = req.path;
  21. data.protocol = req.protocol;
  22. data.route = req.route;
  23. data.subdomains = req.subdomains;
  24. console.log("The function data -->"+ JSON.stringify(data));
  25. res.status(200).send(JSON.stringify(data));
  26. }
Add Comment
Please, Sign In to add comment