Dark Horse Blog - Detailed Steps (Twelve) Article Comments and Exit Functions for the Implementation of Project Functions

8. Article Reviews

1.	创建评论集合
2.	判断用户是否登录,如果用户登录,再允许用户提交评论表单
3.	在服务器端创建文章评论功能对应的路由
4.	在路由请求处理函数中接收客户端传递过来的评论信息
5.	将评论信息存储在评论集合中
6.	将页面重定向回文章详情页面
7.	在文章详情页面路由中获取文章评论信息并展示在页面中

1. Create a comment collection

 

2. Determine whether the user is logged in, if the user is logged in, then allow the user to submit the comment form

Log in to the super administrator and jump to the user management interface

Log in to the normal user and jump to the home page

Modify login interception:

 

User must be logged in to comment

3. Create a route corresponding to the article comment function on the server side

4. Receive the comment information passed by the client in the routing request processing function

5. Store comment information in the comment collection

6. Redirect the page back to the article details page

 

7. Get the article comment information in the article details page route and display it on the page

 

9. Exit function

Set the cookie expiration time, close the browser after logging in, reopen it or log in

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_40794986/article/details/111879044