The Titan project is a full-stack application that fetches quotes from the FavQs API and stores them in a MySQL database. The frontend is built with React, and the backend is built with Express.js. The application allows users to request a specified number of quotes, which are then displayed on the frontend.
- GET /quotes: Fetches a specified number of quotes from the database.
- Backend: The server fetches quotes from the FavQs API and stores them in a MySQL database. It also provides an endpoint to retrieve quotes from the database.
- the qoutes api has bug that return the same qoutes with the same id in diffrent pages.
- Frontend: The React application allows users to request a specified number of quotes, which are then displayed on the page.
- The application fetches quotes in intervals to avoid hitting API rate limits.
- The number of quotes fetched per interval is limited to 30.
- The application does not handle user authentication.
Before setting up the project, ensure you have the following installed:
- Node.js: v14.x or higher
- MySQL: v5.7 or higher
-
Clone the repository:
git clone <repository-url> cd titan
-
Set up the environment variables:
- Create a
.env
file in theserver
directory with the following content:DB_HOST=localhost DB_USER=root DB_PASSWORD= DB_NAME=mydb FAVQS_KEY=your_favqs_api_key
- Create a
-
Run the setup script:
npm run setup
This script will:
- Install dependencies for both the client and server.
- Create the MySQL database and table.
to start e2e test that render the compnent fetch data from server and render it us the test are located in
client\src\test\component.test.js
run
npm run test
To start both the client and server, run:
npm run start