request()

in services/greeter/src/index.js [22:40]


  request(GREETING_URL, function (err, resp, body) {
    if (err) {
      console.error('Error talking to the greeting service: ' + err);
      return res.send(200, 'Failed to communciate to the greeting service, check logs');
    }

    greeting = body;

    request(NAME_URL, function (err, resp, body) {
      if (err) {
        console.error('Error talking to the name service: ' + err);
        return res.send(200, 'Failed to communciate to the name service, check logs');
      }

      name = body;

      res.send(`From ${hostname}: ${greeting} ${name}`);
    })
  })