Created
June 6, 2023 11:51
-
-
Save MichalGrzegorzak/a9fd337ce1e2d46a12cb73d39472a97d to your computer and use it in GitHub Desktop.
AzureFunction GetMyIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName(nameof(GetIP))] | |
public async Task<IActionResult> GetIP( | |
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "check/getIp")] HttpRequest req, ILogger log) | |
{ | |
log.LogInformation("GetIP called"); | |
var client = new HttpClient(); | |
var response = await client.GetAsync(@"https://ifconfig.me"); | |
return new OkObjectResult(await response.Content.ReadAsStringAsync()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment