@nestjs/common#Ip TypeScript Examples
The following examples show how to use
@nestjs/common#Ip.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: weather.controller.ts From life-helper-backend with MIT License | 6 votes |
/**
* 用于未登录状态获取天气详情
*/
@Get(['public', 'common', ''])
getWeather(@Ip() ip: string, @User('id') userId: number, @Query() query: GetWeatherQueryDto): Promise<MixedWeather> {
const location = query.location
const cityId = query.city_id
return this.weatherMainService.getWeather({ ip, userId, location, cityId })
}
Example #2
Source File: ip.controller.ts From life-helper-backend with MIT License | 5 votes |
@Get('')
async queryIp(@Query() query: QueryIpQueryDto, @Ip() ip: string) {
const queriedIp = query.ip ? query.ip : ip
const ipInfo = await this.ipService.queryIp(queriedIp)
return { ...ipInfo, clientIp: ip }
}