Uber Clone API
This project is a simple API for user registration and authentication, inspired by the Uber platform. It is built using Node.js, Express, and MongoDB with Mongoose for data modeling.
Table of Contents
Installation
Clone the repository:
ENVIRONMENT VARIABLE
Middlewares:
Authentication Middleware:
auth.middleware
Function review
Retrieves the JWT token:It checks for the token in both cookies and the Authorization header.Validates the token:It verifies the token using the secret key stored in the environment variable JWT_SECRET.Fetches the user or captain:It uses the decoded token ID to find the corresponding user in the database.Attaches the user or captain object:If the user is found, it attaches the user object to the request object for further use.Handles errors:It catches any errors that occur during the process and sends an appropriate error response.0 likes · 6 views · Feb 7, 2025
Contribute to Subhojit0012/uber development by creating an account on GitHub.