Any example how to implement snapshot for realtime data fetching on front-end?
brerdem opened this issue · 2 comments
I'd like to use realtime functionality of Firestore but couldn't figure out how to fetch data directly from the database without using API endpoints. Is it possible?
Hi @brerdem, on the front end you can access via the strapi server API, or you can access directly via the Firebase JS SDK.
https://firebase.google.com/docs/web/setup
Realtime updates
https://firebase.google.com/docs/firestore/query-data/listen
Be sure to configure the Firestore security rules appropriately as discussed here
https://github.com/arrowheadapps/strapi-connector-firestore#security
I should add, you can configure the Firestore collection names using the collectionName
field in the model's JSON configuration. I added this to the documentation just now.
@brerdem I'll close the issue for now. You should find the official Firestore documentation to be quite sufficient, but feel free to ask if you have any further questions.