U
U
UNy2018-05-06 02:40:24
JavaScript
UNy, 2018-05-06 02:40:24

Implementing express.js comments?

How does the user leave comments on the site? I want to know the algorithm. After entering text in the field and pressing the "comment" button, let's say, the handler is triggered and sends the data to the server, which in turn processes them and displays them from the appropriate place? Do I need to connect to all this database if you want comments to remain after page refresh?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-05-06
@UNy

That's right:
1. The user writes a comment and clicks submit.
2. a request to the server is initiated.
3. The server validates the received data, if it is passed, writes a comment to the database and sends a response with a status of 200 and a comment with an assigned identifier or just an identifier. If not, returns an error.
4. The interface renders the received comment in the thread, or an error message.
The use of a database for this task is mandatory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question