A simple authentication system using Express.js, MongoDB, and JWT authentication.
- Clone the repository:
git clone https://github.com/your-username/your-repo.git
- Install dependencies:
npm install
- Create a
.env
file and add:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key
- Start the server:
npm start
POST /api/auth/register
- Register a new userPOST /api/auth/login
- Login and receive a JWT tokenGET /api/auth/search
- Search user (requires JWT token)
- Register a user.
- Login to get a token.
- Use the token in the
Authorization
header to search for a user.
MIT