title: Return data from response within an observable in Nestjs
body: <p>I'm new to <a href="https://docs.nestjs.com" rel="nofollow noreferrer">Nestjs</a>, Typescript and basically backend development. And I'm working on a simple Weather app, where I fetch weather data from <a href="https://openweathermap.org/api" rel="nofollow noreferrer">Open Weather API</a>.
  I'm using Nest built-in <code>HttpModule</code> which is wrapping Axios within, then using <code>HttpService</code> to make a GET request to Open weather. The request is returning an Observable which is totally news to me.
  How do I extract the actual response data from the observable in the <code>Injectable service</code> and return it to the <code>Controller</code>?</p>
  <p>Here's my weather.service.ts</p>
  <pre><code>import { Injectable, HttpService } from '@nestjs/common';
  
  @Injectable()
  export class AppService {
    constructor(private httpService: HttpService) {}
  
    getWeather() {
      let obs = this.httpService.get('https://api.openweathermap.org/data/2.5/weather?q=cairo&amp;appid=c9661625b3eb09eed099288fbfad560a');
      
      console.log('just before subscribe');
      
      obs.subscribe((x) =&gt; {
          let {weather} = x.data;
          console.log(weather);
      })
      console.log('After subscribe');
      
      // TODO: Should extract and return response data f
      // return;
    }
  }
  </code></pre>
  <p>And this is weather.controller.ts</p>
  <pre><code>import { Controller, Get } from '@nestjs/common';
  import { AppService } from './app.service';
  
  @Controller()
  export class AppController {
    constructor(private readonly appService: AppService) {}
  
    @Get()
    getWeather() {
      const res = this.appService.getWeather();
      return res;
    }
  }
  </code></pre>
  <p>Also can someone clarify what are the missing types in my code?</p>