A simple Node.js + Express.js RESTful API for managing users, books, and reviews. Includes user authentication, CRUD operations, and average rating calculations.
- Node.js
- NPM
- Docker
- MongoDB (via Docker container)
git clone https://github.com/abdelrhman-saeed/book-base.git
cd book-base
npm install
Create a .env
file in the root directory with the following content:
HOST=127.0.0.1
PORT=8000
# MongoDB
MONGO_URI=mongodb://localhost:27017/books
# JWT
JWT_SECRET=secret
POST /api/auth/signup // Register new user
POST /api/auth/signin // Login and get token
GET /api/users
GET /api/users/:id
POST /api/users
PUT /api/users/:id
DELETE /api/users/:id
GET /api/books
GET /api/books/:id
POST /api/books
PUT /api/books/:id
DELETE /api/books/:id
GET /api/book-reviews // Get average book ratings
PUT /api/book-reviews/:id/update // Update user’s rating for a book
You can test the API using the provided Postman collection: Download Collection
Start the development server:
npm run dev
Contributions are welcome! Please open an issue or submit a pull request.
Start your dev server and begin building with the Book Review API.