Reputation: 31
I have made a Blog app using Node.js, Express, and MongoDB. The user has to sign in to create a blog and post it on the site. But, now I want to design a system so that an admin has to approve the user's post before actually publishing that particular blog on the site.
I want to create an admin panel where he/she can see all the user's posts with username and userid. And, I want an approval button or such thing on every post, so that only after admin approves the user's post, it is published on the actual site.
Please suggest me the solution to achieve this.
PS: I do not know how to create the admin panel at all.
Upvotes: 2
Views: 2521
Reputation: 383
I understand you are new in Node.js. So you should know some basic knowledge like the basic API call, how to render a page, creating a Model and also Save, Update And Delete.
If you know about Model, View, Controller, and Routes. Then you can understand the following methodology.
First of all, the Admin Panel is a page like other pages that can only access Admin. For this, you can make a field in the USER model name isAdmin which probably by default False. If isAdmin == True then you can render those Admin Page. You can put a button on the home page which can only show when isAdmin == True. After clicking the button it will take you to that Admin page.
Then, you have to make a field named isApproved in the POST model which also by default False.
In Admin Page you can make a button Approve Post with other information when you click on that button isApproved field of the post will become True.
Finally, A post will show when isApproved == True. You can comment for further solution.
Upvotes: 2