How to link a post created from the front-end to the back-end to handle comments
Hello guys, sorry to disturb you all; I need to store comments for posts in my project. My database, mongoDB, has a post collection and in that collection, I will have an array "comments" which will store the comments for that particular post. The problem is how do I identify the post from the front-end correspond to that post on my database? The idea I first have is to identify the post by its title. The thing is title is not necessarily unique, so there might be some conflicts here. Does anyone have any idea of how I should proceed please.
22 Replies
you're not ready to handle comments
use an already existing solution, like disqus or some alternative
i think facebook has a widget that just shows comments of a post
seriously, you don't want to handle comments
I was thinking of just identifying the comments with the title, like just assuming title can be unique, it is simpler like that
titles in commends????
I mean, a post has comments, in order to know the comments belong to which post, I was thinking of using the post title to uniquely identifies it
dude, trust me on this: forget implementing comments yourself
also, post titles are never unique
and if you change the title, then the comment is a ghost one and won't have an associated post
you always identify by id
but, and i can't stress this enough: you're not ready to handle comments
how are you going to handle spam?
how are you going to implement nsfw stuff?
what about unrully conduct, like people using your site to post discriminatory stuff or other type of garbage?
if you off-load it to a 3rd party, like facebook, then you don't have to do most of the work
just report the comment from facebook and move on
yeah I see
never thought of all that, but you are right
by the way, what is disqus ?
i think that that is the name of the tool for comments
yes, it is
but it is an example of a tool, and not the only solution
yeah I see
disqus provides us with ah API something like that or it is just a service ?
just use facebook
or any alternative to disqus
ok, I will have to read a bit about that, will revert back later on, thanks
you're welcome
i think best way for handel nsfw is use api for detect it im right ?
WHAT api?
there IS a library for nsfw , that works quite well , but it's a frontend lib
search nsfw.js or something
i forgot the name
that's a start
but it isn't a good solution
there are other things that those automated systems can't handle
Also those are concerns that exist for real social networks but don't have to be in scope for hobby or college projects, unless the brief specifies you need to take that into account
Don't overcomplicate shit you don't need to
if this is for a school project, you're right
if this is for a serious project, then what i said isn't scary enough
yeah, but like... dumping a dozen things on someone building a hobby or school project that only platforms with tens of thousands of users need to worry about, as if they're mandatory components of any project of any size, is pretty counterproductive and demotivating
for school, you're absolutely right, and showing your skills is more important
for a hobby project that will be public, that's another story
🤷 It's something you can worry about if and when the project gets traction. Get to minimum viable first, and that's what this question is about, not the thousand other things that you need to worry about once your project gets actual traction.
that makes sense
I think Faker wants to do way too much in a short time anyway. Start by learning the basics and keep adding complexity when you know the last thing you learned well enough
i agree with you