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.
20 Replies
ἔρως
ἔρως3d ago
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
Faker
FakerOP3d ago
I was thinking of just identifying the comments with the title, like just assuming title can be unique, it is simpler like that
ἔρως
ἔρως3d ago
titles in commends????
Faker
FakerOP3d ago
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
ἔρως
ἔρως3d ago
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
Faker
FakerOP3d ago
yeah I see never thought of all that, but you are right by the way, what is disqus ?
ἔρως
ἔρως3d ago
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
Faker
FakerOP3d ago
yeah I see disqus provides us with ah API something like that or it is just a service ?
ἔρως
ἔρως3d ago
just use facebook or any alternative to disqus
Faker
FakerOP3d ago
ok, I will have to read a bit about that, will revert back later on, thanks
ἔρως
ἔρως3d ago
you're welcome
NIMA
NIMA3d ago
i think best way for handel nsfw is use api for detect it im right ?
glutonium
glutonium3d ago
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
ἔρως
ἔρως3d ago
that's a start but it isn't a good solution there are other things that those automated systems can't handle
Jochem
Jochem3d ago
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
ἔρως
ἔρως3d ago
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
Jochem
Jochem3d ago
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
ἔρως
ἔρως3d ago
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
Jochem
Jochem3d ago
🤷 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.
ἔρως
ἔρως3d ago
that makes sense
Want results from more Discord servers?
Add your server