A secure RESTful API built with Node.js, Express, MongoDB, and JWT for user authentication. This project demonstrates backend fundamentals like user registration, login, protected routes, and token-based access control.
🔧 Tech Stack
Node.js
Express.js
MongoDB & Mongoose
JWT (JSON Web Token)
bcryptjs
dotenv
📁 Features
✅ User registration (/api/auth/register)
✅ User login with hashed passwords
✅ JWT-based token authentication
✅ Protected route (/api/auth/profile)
✅ Modular structure (routes, controllers, models)
✅ MongoDB connection via Mongoose
🛠️ Installation
# 1. Clone the repository git clone https://github.com/YOUR_USERNAME/node-auth-api.git
Method Route Description Access POST /api/auth/register Register a new user Public POST /api/auth/login Login & get token Public GET /api/auth/profile Get user profile Protected
🔐 Example Auth Header
Authorization: Bearer <your_token>
📬 Contact Built with ❤️ by Sunil Kumar Rao S
Like this project
Posted Oct 8, 2025
Built a secure RESTful API for user authentication using Node.js and Express.