The idea of this project comes form the js-course, but over there the teacher decided to create a Students API, while I prefered to keep the Contacts Agenda context based on the previous full stack agenda-nodejs project. The main difference here was the introduction of:
- Multer for handling with images uploads;
- Sequelize for handling with relational database operations (the course uses MariaDB, but I choose to work with PostgreSQL);
- JSON Web Token for managing access to protected routes of the api;
- Usage of tools for creating and organizing the http requests for testing the api (the courses uses Insomnia, but I choose to work with Postman);
As said, based on the previous project and in the course, I made some improvements like:
- Phone Number validation using the google-libphonenumber;
- Models logic:
- Each User has his unique contact list and cannot access or modify other users lists;
- Creating a restriction that only allows a User to delete his account after removing all of his contacts;
- Users can upload photos (like having a gallery) and after it they can associate one photo for profile picture of himself or his contacts;
- Add Photo routes:
- Index: the User can view all of his photos;
- Show: the User can view one of his photos based on ID;
- Delete: the User can delete one of his photos based on ID (I used the fs-extra).