hatchways / team-goku

0 stars 0 forks source link

DB Setup and a basic User Route #24

Closed hrindrsmaan closed 3 years ago

hrindrsmaan commented 3 years ago

Hi Sina,

I've set up the db with node using mongoose and i'm using online resource called MongoDB ATLAS for creating collections on cloud.

I've created a schema called "User" having name, email and password as columns.

Also, I've created two routes one for adding new user to the database and other for getting all the users from the database.

Routes are as follows:

1) POST request for adding new user http://127.0.0.1:5000/users/register Body: { "name":"steve job", "email": "steve.job@gmail.com", "password": "123456" }

2) GET request to get all the users from the DB http://127.0.0.1:5000/users/ OUTPUT: [ { "_id": "5ffecd264473225d20f6bc2e", "name": "steve job", "email": "steve.job@gmail.com", "password": "123456", "__v": 0 } ]

Let me know if i'm on the right track ?

hrindrsmaan commented 3 years ago

Hi Sina,

I added the User routes for register, login and home page and encrypted the user password using bcrypt library.

Authentication based on email and password is done.

Added some code about JWT for making the web app more secure and still in progress

hrindrsmaan commented 3 years ago

Hi Sina, I have added the code for User Authorization using JWT . Please review it and let me know the improvements. Thank you.