How to integrate news article / comments with Firebase?
·
Answer a question
I've been trying to create an app that follows these three steps:
- Register via Facebook
- Create new user in Firebase database
- Allow registered users to see news articles and comment
I am stuck on #3. I'm not sure this is efficient, but I want to post articles on a site such as Wordpress or whatever and parse the JSON to the app. However, I do not know how to implement the comments.
Answers
You could have, in the Firebase realtime DB, a structure like:
[root]
-[article_urls]
-[comments]
-[comment_id]
-[content]->value
-[user_id]->value
etc. The interesting bit of the Firebase database documentation would be:
- best practice firebase database: ie, keep your data flat
- How to add data to a list in Firebase database: When you add a new comment to an article you are actually adding it to a list
更多推荐
所有评论(0)