This project implements a simple Node.js Express API that connects to MongoDB and retrieves user data.
- GET
/users/:idendpoint:- Finds a user by
_id - Returns details only if age > 21
- Returns
404if not found or underage - Handles invalid ObjectId errors gracefully
- Finds a user by
- Node.js
- Express.js
- MongoDB with Mongoose
- dotenv for environment management
- Clone repo:
git clone <your-repo-url> cd node-mongo-api