Skip to content

vglu/AzureFunctionAlgoliaUpdateIndexFromJson

Repository files navigation

Azure function for publishing JSON file to Algolia index

Motivation

Main goal - have possibility to call it native way from DevOps pipeline

Example of use - HUGO site on Azure and we should publish json file to Algolia with TechDoc theme.

Usage

For local development or testing we should use file local.settings.json - where inside section Values we add 4 parameters

​ "AlgoliaAppId":"Application Id from Algolia site", ​ "AlgoliaAdminKey": "Admin key from algolia site", ​ "AlgoliaIndexName": "Index name from algolia site", ​ "JSON_URL":"https://URL/algolia.json"

For usage in Azure - we should add this parameters to Application settings

Application settings

function updateIndexFromURL - update index from url function sendNewJsonToAlgolia - update index from multi part form data request with file You can setup Hugo site hosted on Azure. You can setup Azure DevOps pipeline for Hugo static site to support CI-CD foe static web site. You can use additional step to call algolia index update. In general, this function can be used from Power Shell - Invoke-WebRequest, or from Postman (example below).

Deploy

clone this repository, publish azure function from VS code

clone - git clone https://github.com/vglu/AzureFunctionAlgoliaUpdateIndexFromJson.git

Azure extension for VS code https://code.visualstudio.com/docs/azure/extensions

CI/CD

Too many variants how to use CI/CD with Azure function. I have created Azure DevOps project based on GitHub repository and setup Build and Release pipelines from Azure DevOps

Postman usage

Here is example how to use it from Postman

Headers

Body

About

Azure function for updating Algolia (http://algolia.com/) index from JSON file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published