Skip to content

πŸš€ Welcome to the Fullstack Bootcamp Project repository! 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.

License

Notifications You must be signed in to change notification settings

Alexandrbig1/rest-api-goit-NodeJS

Β 
Β 

Repository files navigation

Fullstack Bootcamp Node.js Backend Project

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

This repository contains a Node.js REST API project developed during my full-stack bootcamp. The project spans from the 2nd homework assignment to the 6th and serves as a practical implementation of the concepts covered in the bootcamp. It provides a foundation for building scalable and robust RESTful web services.

Table of Contents

Homework2: HTTP Requests and JSON Contact Management

The second homework assignment focuses on working with HTTP requests in a Alt text environment. The project involves managing a Alt text file containing contacts. The application allows performing various operations on the contacts, including:

API 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.
  • (DELETE) /api/contacts/:contactId: Delete an existing contact from the list.

Technologies Used

  • Node.js: The runtime environment for executing the application.
  • Express.js: A web application framework for building RESTful APIs.
  • Cors: Middleware for handling Cross-Origin Resource Sharing in Express.js applications.
  • Morgan: HTTP request logger middleware for Express.js.
  • UUID: Used for generating unique IDs for various purposes.
  • JSON: Data interchange format used in the project.

Homework3: Node.js, MongoDB, and Mongoose CRUD Backend

The third homework assignment builds upon the previous project, now incorporating MongoDB with Mongoose for data persistence. The application manages contacts stored in a MongoDB database and allows users to perform various operations on the contacts. The supported CRUD operations include:

API 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.

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.
  • Express.js: A web application framework for building RESTful APIs.
  • JSON: Data interchange format used in the project.

Homework4: Node.js, MongoDB, Mongoose, and JWT Authentication with Extended Contact Management

The fourth homework assignment extends the capabilities developed in previous projects, specifically focusing on HTTP requests, JSON contact management, and MongoDB integration. Building upon this foundation, the current module introduces a robust authentication system using JSON Web Token (JWT) and enhances the contact management system with additional features to provide a more comprehensive and secure user experience.

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.

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.

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.

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.

Homework6: Email Verification with Nodemailer

The sixth homework assignment builds upon prior projects, introduces a crucial featureβ€”email verification using the Nodemailer API. This module is dedicated to fortifying user security and refining access control within our application.

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.
  • (GET) /api/users/verify/:verificationToken: Verify the user's email address using the provided token.
  • (POST) /api/users/verify: Request a second verification email.

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.

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.
  • Nodemailer: Email sending module for Node.js.

Getting Started

Follow these instructions to set up the project on your local machine for development and testing purposes.

Requirements

  • Node.js installed
  • NPM (Node Package Manager) installed

Installing

  1. Clone the repository to your local machine.
    git clone https://github.com/Alexandrbig1/nodejs-rest-api-homework.git
  2. Navigate to the project folder.
    cd nodejs-rest-api-homework
  3. Install dependencies.
    npm install

Running the Application

  • Production Mode:
    npm start
  • Development Mode with Nodemon:
    npm run dev
  • Running Tests To execute unit tests using Jest, use the following command:
    npm run test

Project 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.
  • (GET) /api/users/verify/:verificationToken: Verify the user's email address using the provided token.
  • (POST) /api/users/verify: Request a second verification email.

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.

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.

Acknowledgments

I extend my sincere gratitude to the entire team at GoIT for their unwavering guidance and support during my enriching journey through the Fullstack Bootcamp. This comprehensive 10-month program has equipped me with valuable skills across various modules, and I am particularly grateful for the in-depth learning experience in Node.js, which serves as the final module in this transformative bootcamp.

Languages and Tools:

Connect with me:

About

πŸš€ Welcome to the Fullstack Bootcamp Project repository! 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%