How to add search to static nuget feed
I have been using static serverless nuget feeds for a while now. Sleet is totally awesome. One missing piece was search: searching a static feed would just return everything, always. Not anymore!
To set it up:
- 1.Fork Sleet.Search: this is the Azure function project that will perform the search on your static feeds. You'll host your own in a consumption (aka serverless) plan in Azure.
- 2.Create an Azure Functions app and follow the deployment steps from my blog: that's basically setting up the simplest CI/CD for a GH repo.
- 3.By default, the project allows passing in the static feed "search" url (which is a blob named under
/search/queryin your sleet blob container) and requires function authentication. In my case, I wanted a simpler search URL and anonymous access, so I made that change to Sleet.Search. Basically the function can now be accessed at
/query, without URL-encoding another URL parameter there.
That's it. Now you can configure my feed https://pkg.kzu.io/index.json and it will be fully searchable. Plus, I used Azure Functions Proxies to make the blob storage URL that much nicer. I even made the query URL nice, since it was trivial too: https://pkg.kzu.io/search 😍.