This application allows users to search the Google Books API via a Next.js app that consists of the front-end written in React, and the API server written with FastAPI.
- Clone the repository from Github:
# ssh
git clone [email protected]:pmccaughtry/book-finder.git
# https
git clone https://github.com/pmccaughtry/book-finder.git
- Create a virtual environment for the API
# Step 1: go to the api directory
cd api
# Step 2: create the virtual environment
python3 -m venv .venv
# Step 3: activate the virtual environment
source .venv/bin/activate
Note: If you receive errors creating a virtual environment you may need to install venv with pip3 install venv
and then repeat steps 2. and 3. above.
- Install NPM dependencies from the project root (book-finder):
npm install
npm run dev
starts both the client and API concurrently.
npm run next-dev
npm run fastapi-dev
# Any of the following commands can be used in place of the examples above.
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Client: localhost:3000
API: localhost:8000
/books - returns JSON containing data related to the books that were searched (e.g., book cover, author information, book details)
/health - returns { 'status': 'OK' } if the server is running properly
/health-details returns details about uptime, cpu, and virtual memory
There is also a catch-all route to gracefully handle any non-existent routes, returning a 200 to mess with bots, bad actors, etc
This is a Next.js project bootstrapped with create-next-app
.