title: TypeError: undefined is not a function in node js
body: <p>I am trying to get data from server and show it on web page but
   I am getting a error at  end of file </p>
  
  <p>response.end(body);</p>
  
  <p>TypeError: undefined is not a function</p>
  
  <p>i don't get what the error is please help</p>
  
  <p>My Nodejs Code</p>
  
  <pre><code>var express=require("express");
  var app=express();
  
  var request = require('request');
  var passport = require('passport')
  var LocalStrategy = require('passport-local').Strategy;
  var bodyParser     =        require("body-parser");
  
  app.use(bodyParser.urlencoded({ extended: false }));
  
  app.get('/service',function(req,res){
      var id = req.query.name; 
      console.log('hi');
      console.log(id);
      request.post({
                   headers: {
                              //set header if needed
                             },
                   url    : 'http://example.com:8080/rest/api/2/issue/id',
                   json   : {
                               userName:'username',
                               password:'password'
                             }
                  },
                  function(error, response, body){
                      if(error) {
                          console.log(error);
                      } else {
                          response.end(body);
                      }
              });
  });
  console.log('running');
  app.listen(8082);
  </code></pre>