title: res.json is not a function in Node.js module
body: <p>I'm trying to setup google recaptcha using this tutorial (<a href="https://codeforgeek.com/2016/03/google-recaptcha-node-js-tutorial/" rel="nofollow noreferrer">https://codeforgeek.com/2016/03/google-recaptcha-node-js-tutorial/</a>) and move the recaptcha code into it's own module. I get:</p>
  
  <pre>
  TypeError: res.json is not a function
  </pre>
  
  <p>in the console when I try this code:</p>
  
  <pre><code>var checkRecaptcha = function(req, res){
      // g-recaptcha-response is the key that browser will generate upon form submit.
      // if its blank or null means user has not selected the captcha, so return the error.
  
      if(req.body['g-recaptcha-response'] === undefined || req.body['g-recaptcha-response'] === '' || req.body['g-recaptcha-response'] === null) {
          return res.json({"responseCode" : 1,"responseDesc" : "Please select captcha"});
      }
  
      // Put your secret key here.
      var secretKey = "************";
  
      // req.connection.remoteAddress will provide IP address of connected user.
      var verificationUrl = "https://www.google.com/recaptcha/api/siteverify?secret=" + secretKey + "&amp;response=" + req.body['g-recaptcha-response'] + "&amp;remoteip=" + req.connection.remoteAddress;
  
      // Hitting GET request to the URL, Google will respond with success or error scenario.
      var request = require('request');
      request(verificationUrl,function(error,response,body) {
  
          body = JSON.parse(body);
          // Success will be true or false depending upon captcha validation.
          if(body.success !== undefined &amp;&amp; !body.success) {
              return res.json({"responseCode" : 1,"responseDesc" : "Failed captcha verification"});
          }
          return res.json({"responseCode" : 0,"responseDesc" : "Sucess"});
      });
  }
  
  module.exports = {checkRecaptcha};
  </code></pre>
  
  <p>Why does this happen? I do have <code>app.use(bodyParser.json());</code> set in my app.js and <code>res.json()</code> seems to work fine in other parts of my app, just not this recaptcha module.</p>