This is the backend REST API for the BookNook online library application. It handles database operations, book borrowing logic, and JWT-protected routes using Express.js and MongoDB.
- Base API URL: https://booknook-server-iz9u.onrender.com
- Express.js & MongoDB: High-performance backend utilizing MongoDB Atlas for data storage.
- JWT Protection: Secure API endpoints using
joselibrary for JSON Web Token (JWT) validation middleware. - Book Management: APIs for creating, reading, updating, and deleting (CRUD) books.
- Borrow Logic: Handles book borrowing with
$incoperators to manage available copies automatically. - No Double Borrow: Prevents users from borrowing the same book multiple times simultaneously.
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Native Driver)
- Security: JWT (jose), CORS
- Clone the repository:
git clone <your-server-repo-link> - Install dependencies:
npm install - Create a
.envfile withPORT,MONGODB_URI, andBETTER_AUTH_URL. - Run the server:
npm run devornode index.js