Create endpoint for user-registration
Compare changes
Libraries:
Connect with 'mongodb-memory-server' initially (Will change it to MongoDB Atlas later)
Create endpoints for POST requests - /register, /login, /updateUser, /user/:username
Create User.model.js which contains the properties of the schema using mongoose
Create Controllers for /register, /login, /updateUser, /user/:username
Validate authentication
Start server by npm start
in the daily-thought-user-service/server directory
You have to register first, and then log in. You can only log in with your username and password.
You have to register first, and then can use this route. It is a GET request.
This is a PUT Request. After you register and login, you have to get the 'token' from the login route. You have to paste this token in the Auth>Bearer of the /updateuser.
Then you click send, and you will get the following response:
If you go to the GetUser [/user/:username] route again, you will see the email and profile got updated.
Please ensure the 'Mongoose' is of version "mongoose": "^6.8.0",
, as some methods do not work in the newer version.