Skip to content

Instantly share code, notes, and snippets.

@marce1994
Last active April 26, 2019 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marce1994/b85a6143567c0922f8923222e99207d5 to your computer and use it in GitHub Desktop.
Save marce1994/b85a6143567c0922f8923222e99207d5 to your computer and use it in GitHub Desktop.
// https://github.com/marce1994/DockerAzureFunctionsDemo/blob/master/FunctionZonapropScrapping.cs
//...
[FunctionName("FunctionZonapropScrapping")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log)
{
int pageNumber = 0;
if (!int.TryParse(req.Query["pageNumber"], out pageNumber)) return new BadRequestResult();
var scrapper = new ZonapropScrapper();
var result = await scrapper.GetDataAsync(pageNumber);
return new JsonResult(result)
{
SerializerSettings = new JsonSerializerSettings()
{
Formatting = Formatting.Indented
}
};
}
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment