This repository contains a Node.js API that provides authentication functionality for use in various applications. The API utilizes JWT (JSON Web Tokens) for authentication and MongoDB as its database. It also incorporates Mongoose to create models and connect to the Express server, bcryptjs for password hashing, and jwt to secure private routes.
- Node.js
- Express.js
- MongoDB
- Mongoose
- bcryptjs
- JSON Web Tokens (JWT)
- Clone the repository to your local machine using
git clone
URL - Install the required dependencies:
npm install
- Set up the MongoDB connection:
Make sure you have MongoDB installed and running.
Edit the config.js file to specify your MongoDB connection URL.
To start the server, use the following command:
npm start
The server will be running at http://localhost:3000 by default. You can change the port by modifying the PORT constant in the index.js file.
The following API endpoints are available:
POST /api/user/login
POST /api/user/register
Feel free to use, modify, and distribute this code as per the terms of the MIT License. However, please note that this project comes with no warranties. Use it at your own risk.