This API provides functionality for managing users, including registration, authentication, profile management, and more.
This project aims to assess someone's basic backend development skills by implementing a User Management API using Node.js and MongoDB. The API includes endpoints for user registration, authentication, profile management, and more.
- User registration with validation
- User authentication using JWT tokens
- User profile management
- User role management
- Secure password hashing
- API documentation using Swagger
- Unit testing using Chai and Mocha
- Node.js
- MongoDB
- Express.js
- Swagger (for documentation)
- Chai & Mocha (for testing)
-
Clone the repository:
git clone https://github.com/harshsoni-harsh/user-management-backend
-
Install dependencies:
npm install
Create a .env.local
file in the root directory of the project and add the following environment variables:
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>
Start the server:
npm start
The API will be available at http://localhost:3000
.
The API endpoints are documented using Swagger. To view the documentation, open your web browser and navigate to http://localhost:3000/docs
.
To run the tests:
npm run test