title: How to send data in post body in angular 4
body: <p>Below is the code to make post request:</p>
  
  <pre><code>export class AuthenticationService {
  
      private authUrl = 'http://localhost:5555/api/auth';
  
      constructor(private http: HttpClient) {}
  
      login(username: string, password: string) {
        console.log(username);
        let data = {'username': username, 'password': password};
        const headers = new HttpHeaders ({'Content-Type': 'application/json'});
        //let options = new RequestOptions({headers: headers});
        return this.http.post&lt;any&gt;(this.authUrl, JSON.stringify({data: data}), {headers: headers});
      }
  }
  </code></pre>
  
  <p>Below is the node code where I am trying to access the request body,  Request body is null in the helow case:</p>
  
  <pre><code>router.use(express.static(path.join('webpage')));
  
  var bodyParser = require('body-parser');
  
  router.use(bodyParser.urlencoded({ extended: true }));
  
  router.post('/api/auth', function(req, res){
    console.log(req.body);
    console.log(req.body.username + ":" + req.body.password);
  });
  </code></pre>