Note: a fair amount of help from ChatGPT throughout
The microservice can be run with or without docker-compose
docker-compose up
Note: if you for whatever reason make changes to the dockerfiles or docker-compose.yml files, the rebuild with
docker-compose up --build
Note: nginx is somewhat superflous, unless this is deployed on a remote server, with many users, and/or larger data
Note: not so trivial to do with postgres. Switch back to sqlite. Last working version
with sqlite:
https://github.com/LAMaglan/FinalFantasyFast/tree/8c592d633d37a16d3facbe26c92949ad50d0153a
The backend (FastAPI) runs with poetry:
cd backend
poetry shell
python intialize_db.py
uvicorn main:app --reload
Frontend runs on React.js , using axios to make HTTP requests to the FastAPI backend. To run the frontend (while the backend is running), do:
cd react-frontend
npm start
The backend retrieves data from external Final fantasy api https://www.moogleapi.com/
With default settings, you can test out the API through swagger docs: http://127.0.0.1:8000/docs/ or http://0.0.0.0:8000/docs/ if using the docker-compose approach.
The characters
and monsters
routers fetches data from the above link,
and stores them in a postgres database.
Note: the use of (postgres) database is somewhat superflous, there are no POST endpoints in the backend API.
The frontend is accessible through http://localhost:3000