This project is a RESTful API for user authentication and management. It provides endpoints for user registration, login, and profile management. The API uses various technologies such as JWT, bcrypt, Express, and Mongoose.
The following technologies are used in this project:
- JWT (JSON Web Tokens): Used for authentication and generating secure tokens for user sessions.
- bcrypt: Used for hashing and salting user passwords for secure storage.
- Express: A fast and minimalist web framework for Node.js used for building the API endpoints.
- Mongoose: An object modeling library for MongoDB used for database interactions and data validation.
To get started with the project, follow these instructions:
You need to have the following software installed on your system:
- Node.js: Install Node.js from the official website - https://nodejs.org
-
Clone the repository:
git clone https://github.com/edilsobai/auth_users-api.git
-
Navigate to the project directory:
cd auth-users-api
-
Install the dependencies:
npm install
Set up the environment variables:
-
Create a .env file in the root directory of the project. Add the following environment variables:
PORT=3000 JWT_SECRET=your_jwt_secret MONGODB_URI=your_mongodb_uri
-
Start the server:
npm start
-
The API will now be running on:
http://localhost:5000.
The Auth Users API provides the following endpoints:
- POST /api/register: Register a new user.
- POST /api/login: User login.
- GET /api/profile: Get user profile (requires authentication).