I’m pretty close to finish the “Strapi Hooks” article I’ve been writing for the last couple of months.
It’s a review and comparison on the three different types of hooks in Strapi:
There’s just one section that I’m looking to improve, which is: providing interesting use case examples
for each type of hook.
As I don’t have enough material about this topic, thought I’d reach out to the community in search for
cool use cases where you may have used hooks in a project (or not, it could just be anything that occurs to you).
Let me kickstart the conversation with what I have so far:
Looking forward to reading your article, I hope it really reflects all the possibilities in this case the hooks for customisation with Strapi. I have some to add to your list.
use cases/examples:
Server hooks:
The docs have an detailed guide on how to integrate an third party client (in this case GitHub) with strapi, worth mentioning.
Nice to see strapi-hook-algolia there (it uses also the lifecycle hooks in its implementation).
Lifecycle hooks:
Sending email/notification on create/update.
Something I’ve been thinking of: a hook to clear cloudflare CDN cache when content is edited.
(I can imagine how that would be doable with REST API, graphql - would be tricky, if you use the automatic persisted queries you have to create the same hashed query string to create an exact URL to send to them… IDK, when I’m thinking of doing that I’ll open that as its own issue)
I took a quick look, looks really cool! I’ll have to take a closer look.
My site is now a static site, so I have a hook which rebuilds and then clears the CDN.
With a bigger site, I’d want to just clear files which changed - which is easier then in your example, because there’s no API calls from the client, just static html and JSON.
As I have implemented custom hook in my strapi , Its not working ,nothing is showing in terminal ,I can not able to get the problem.
Can you please help