This project is an authentication system built with Node.js, Express, and MySQL. It uses JSON Web Tokens (JWT) for authentication and cookie-parser for handling cookies.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Node.js
- MySQL
- PNPM (You can install it globally with
npm install -g pnpm
)
- Clone the repository:
git clone https://github.com/yourusername/yourrepository.git
- Navigate into the project directory:
cd yourrepository
- Install the dependencies:
pnpm install
- Create a
.env
file in the root of your project and add the following variables:DB_HOST
: Your MySQL hostDB_USER
: Your MySQL userDB_PASSWORD
: Your MySQL passwordDB_NAME
: Your MySQL database nameJWT_SECRET
: Your JWT secret (you can generate one using a random string generator)
- Start the server:
pnpm run start
The project includes the following endpoints:
POST /auth/register
: Register a new user. The body of the request should be a JSON object withemail
andpassword
properties.POST /auth/login
: Log in a user. The body of the request should be a JSON object withemail
andpassword
properties.GET /auth/users
: Get all users. This endpoint requires a valid JWT in theAuthorization
header.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE.md file for details