- Create a directory that is a REAL ESTATE WEB APP.
- Create a directory that is an API. (back end)
- routes: auth, post, user
- controllers -> auth controller -> make register api
- Install Prisma
- Create a database using MongoDB.
- Create a user model (schema file). After making any changes to prisma.schema, run "npx prisma db push."
- Create a new user and save it to the database. install prismaClient Make a directory lib->prisma.js, then export prisma and use it in the auth controller file to create a new user.
When I hit the register API, I got some errors.
PrismaClientValidationError:
Invalid prisma.user.create()
invocation:
then I install 'npx prisma generate' in the run 9. npx prisma db push: any changes in db
- Make login API install cookie-parser also use a JWT token.
- Make a logout API
-
Register routes.
-
login routes
-
In the library directory, create apirequest.js for the base URL.
-
Registration and login are completed (bugs fixed).
-
Logout features completed
-
Authentiaction: should-be-logged-in, should-be-admin
-
Make a middleware -> verifyToken
-
login nhi hai fir v hm profile page access kar pa rhe hai to react contextapi se ye handle kar skte hai, we can store our user information anywhere, when our needed, just call caontext hook and we can reach that data and also we will create function that we update our user for example username, avatar, immediatlly.
-
When I logged out and went back, it showed an error message. So now I fixed this issue using the context API and navigated to the login page.
-
Update profile: For an updated profile, I make a file whose file name is profileupdatepage, and then I use the context API to update the username, password, and avatar.
-
api-> make a route for user -> user update, delete, get user, get users
-
client -> make ui for above routes
-
update avatar
-
update User model and create post, type, property model
-
push->using this cmd-> npx prisma db push
-
create post router -> get posts, get post, create post, delete post.
-
create post controller -> get posts, get post, create post, delete post.