Blog Using the MERN Stack Part 2 - Setting up CRUD on the backend
Introduction
In programming, CRUD stands for: CREATE, READ, UPDATE and DELETE which are the four functions of persistant storage.
Now, for web development, we have HTTP request methods. The four CRUD functions can be mapped to their respective HTTP request methods:
CRUD
HTTP Request
CREATE
POST
READ
GET
UPDATE
PUT
DELETE
DELETE
User Stories
We need to think about how a user will interact with the site. Do we want to have logged in users interact with the site or do we want to have all users to have CRUD functionality? I don't think the latter is very functional.
User not logged in
As a user who is not logged in, I want to be able to:
View all posts
View a specific post
Logged in user
As a user who is logged in, I want to be able to:
Do everything that a user that is not logged can do
Create a post
Edit a post
Delete a post
Edit my details
Admin
As an admin, I want to be able to:
View all posts
View a specific post
Create a post
Edit a post
Delete a post
Delete a user
With this we can see that we want two databases:
Users
Posts
Setting up our database
We'll start off using a local database first to get functionality up an running.
Last updated
Was this helpful?