title: Send response to client in nodejs
body: <p>Unable to send response data back to client. Its throwing error saying <code>response.write()</code> is not a function:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var request = require('request');
  
  var port = process.env.PORT || 5000;
  app.set('port', (port));
  
  app.use(express.static(__dirname + '/'));
  app.get('/', function(request, response) {
    response.render('/');
  });
  
  app.listen(app.get('port'), function() {
    console.log('Node app is running on port', app.get('port'));
  });
  
  app.post('/login', verifyLogin);
  
  function verifyLogin(req, res, next) {
      var loginParams = {
          'username': req.body.username,
          'password': req.body.password
      };
  
      request({
          url: 'http://localhost:8084/xxx/auth', //URL to hit
          qs: {username: req.body.username, password: req.body.password},
          method: 'POST',
          json: {
              "username": req.body.username, "password": req.body.password
          }
          }, function(error, response, body){
          if(error) {
              console.log(error);
          } else {
          response.write(body); // ERROR here response.write is not a function
          return response;
      }
  });
  </code></pre>
  
  <p>I am getting the response data in command prompt console but how do I send response data back to client?</p>