This is a full-stack Book Review Application that allows users to browse, add, edit, and delete book reviews. The backend is built using Node.js and Express.js, and the frontend is developed using React.js. The application uses MySQL to store book reviews.
- MySQL installed on your system.
- Node.js and npm installed on your system.
- React.js (via Create React App) for the frontend.
Clone the repository to your local machine.
git clone <repository_url>
cd book-review- Open your MySQL command line or MySQL Workbench.
- Create a new database called
myapp.
CREATE DATABASE myapp;- Create a new user with username
jhonand password12345.
CREATE USER 'jhon'@'localhost' IDENTIFIED BY '12345';- Grant the necessary privileges to the new user.
GRANT ALL PRIVILEGES ON myapp.* TO 'jhon'@'localhost';- Flush privileges.
FLUSH PRIVILEGES;- Now, you need to run the database schema SQL file to generate the tables and data. Save the SQL script provided below as
schema.sqland run it in your MySQL.
USE myapp;
CREATE TABLE reviews (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
rating INT NOT NULL,
reviewText TEXT NOT NULL,
dateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO reviews (title, author, rating, reviewText) VALUES
('The Great Gatsby', 'F. Scott Fitzgerald', 5, 'An amazing classic with themes of wealth, love, and loss.'),
('1984', 'George Orwell', 4, 'A thought-provoking book about surveillance and totalitarianism.'),
('To Kill a Mockingbird', 'Harper Lee', 5, 'A timeless story of racial injustice and the loss of innocence.');Run the above schema.sql script to create the reviews table and insert some initial data.
- Navigate to the backend folder inside your project.
cd backend- Install the necessary dependencies.
npm install- Configure the database connection in the backend. Open the
backend/config/database.jsfile and modify the connection settings:
module.exports = {
host: 'localhost',
user: 'jhon',
password: '12345',
database: 'myapp'
};- Start the backend server.
npm startThis will start the backend server on http://localhost:5000.
- Navigate to the frontend folder.
cd frontend- Install the necessary dependencies for the frontend.
npm install- Start the frontend application.
npm startThis will start the React.js frontend on http://localhost:3001.
- The frontend will be available at
http://localhost:3001. - The backend API will be available at
http://localhost:3000.
You can now interact with the application. You will be able to:
- View a list of book reviews.
- Add, update, and delete reviews.
- Filter reviews based on ratings.
- Frontend: React.js
- Backend: Node.js, Express.js
- Database: MySQL
This Book Review Application allows users to share their opinions on books and discover new books through reviews from others. It demonstrates a full-stack application built with React for the frontend, Node.js and Express for the backend, and MySQL as the database.