File size: 578 Bytes
97dab2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// src/weather.controller.ts
import { Controller } from '@nestjs/common';
import { GrpcMethod } from '@nestjs/microservices';
import { WeatherApiService } from './weatherapi.service';

@Controller()
export class WeatherApiController {
  constructor(private readonly weatherService: WeatherApiService) {}

  @GrpcMethod('WeatherApiService', 'GetCurrentWeather')
  getCurrentWeather(data) {
    return this.weatherService.getCurrentWeather(data);
  }

  @GrpcMethod('WeatherApiService', 'GetForecast')
  getForecast(data) {
    return this.weatherService.getForecast(data);
  }
}