/rest-api-goit-NodeJS

This Node.js REST API, developed through my 2nd to 6th homework assignments, is a hands-on showcase of my learning journey. Explore diverse features, RESTful endpoints of this project.

Primary LanguageJavaScript

External REST API Integration, Avatar Management, and Jest Testing

GitHub last commit Node.js Version Express.js Version MongoDB Mongoose Version JWT Jest Gravatar

Welcome to the fifth homework assignment in the Fullstack Bootcamp, where we continue to build upon the foundation laid by our previous projects, especially those emphasizing HTTP requests. This module signifies a shift in focus towards more advanced features. In this stage, we explore the integration of sophisticated functionalities, such as the ability to add avatars for users upon creation. This enhancement not only adds a personalized touch to user profiles but also enriches the overall user experience. Additionally, we delve into the world of Jest unit testing, ensuring the reliability and robustness of our application. This step reflects our commitment to delivering high-quality Fullstack solutions. As we integrate these innovations, we look forward to the unfolding possibilities on our journey of continuous skill development.

Homework5: External REST API Integration, Avatar Management, and Jest Testing

The fifth homework assignment builds upon the solid foundation of previous projects, expanding the capabilities of the application to include external REST API integration, avatar management, and Jest testing for enhanced functionality and reliability.

API Endpoints

Contact endpoints

  • (GET) /api/contacts: Retrieve a list of all contacts.
  • (GET) /api/contacts/:contactId: Retrieve a specific contact by ID.
  • (POST) /api/contacts: Add a new contact to the list.
  • (PUT) /api/contacts/:contactId: Update an existing contact's information.
  • (PATCH) /api/contacts/:contactId/favorite: Partially update an existing contact's information.
  • (DELETE) /api/contacts/:contactId: Delete an existing contact from the list.

User endpoints

  • (POST) /api/users/signup: Register a new user.
  • (POST) /api/users/signin: Login and obtain a JWT.
  • (POST) /api/users/logout: Logout the user.
  • (GET) /api/users/current: Retrieve information about the currently logged-in user.
  • (PATCH) /api/users/avatars: Change the user's avatar.

Additional Endpoints

  • (GET) /api/contacts?page=<page_number>&limit=<page_size>: Retrieve paginated contacts.
  • (GET) /api/contacts?favorite=true: Retrieve contacts marked as favorites.
  • (PATCH) /api/users: Update the user's subscription level.

Avatar Management

  • Avatars are automatically generated for new users using the Gravatar package.
  • Introduces a new endpoint (PATCH) /api/users/avatars for users to change their avatars.
  • Jimp package is utilized for image processing related to avatars.

Jest Testing for Login

  • Implements Jest testing to ensure the robustness of the login functionality.
  • Unit tests are created to validate the authentication system, enhancing the overall reliability of the application.
  • Run tests using npm run test script defined in the package.json file.

Technologies Used

  • Node.js: The runtime environment for executing the application.
  • MongoDB: A NoSQL database for data persistence.
  • Mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js.
  • JSON Web Token: Used for user authentication.
  • Express.js: A web application framework for building RESTful APIs.
  • JSON: Data interchange format used in the project.
  • Jest:JavaScript testing framework ensuring code reliability and simplicity.
  • Gravatar: Global avatar service for user profile images linked to email addresses.

Issues

If you encounter any issues or have suggestions, please open an issue.

Feedback

I welcome feedback and suggestions from users to improve the application's functionality and user experience.

Languages and Tools:

JavaScript NodeJS MongoDB Express Jest git