The tasks we have to do on this side of the project are very simple. We just need to accept the data sent at the frontend, validate it, and create the user on the database by first encrypting the password of the user. As we are going to allow the users to upload an avatar, we will also handle the processing of the image in order to show it everywhere.
The requirements in the API level are as follows:
Accept the
POST
request at the/api/users[/:id]
endpointProcess the image and store it on the server
Encrypt the password of the user before storing the data
As we already have the users
table, there is no need to create a table or modify it; we are going to use the same one. But before jumping to the next section and start coding, we need to talk about the password
column in the users
table.
If you notice, the password
column is a BINARY(60)
value. This is because the component we are going to use to encrypt the password is based on bcrypt, and...