This is a spring boot reactjs application using a postgresql database. This application uses the nfl.com live updates api. This is just a little pet project for learning ReactJS in a Spring Boot application. I'm also learning Postgresql since that is a popular AWS database. The application will gather game center data from the nfl api and use it to help with my fantasy football team.
Add Team Entity and Team Repository to represent the team data in the database. Add a Rest endpoint to provide a list of all teams in the database. And finally added code to display the teams as JSON in the UI.
This is the initial version with all of the three main pieces (Spring Boot, ReactJS & Postgresql) working together. Not much functionality yet just the initial shell of the application. The database tables have been defined and the basic user interface layout has been defined.
- Spring Boot -
v2.2.2-RELEASE
- Java -
v1.8
- ReactJS -
v16.12.0
- Postgresql -
v12.1
- Gradle -
v6.0.1
- Yarn -
v1.19.2
I use a Mac and IntelliJ IDEA so these instructions are for that setup. After you clone the repository then follow the steps below.
First step is to start the Postgresql database in a docker container. To do that run the following command of course
replace the <password>
with your own:
docker run --name nflstats -e POSTGRES_PASSWORD=<password> -d -p 5432:5432 postgres
Next you will need to setup the database and initialize the tables. I do this from IntelliJ and the database init
scripts can be found in nfl-stats-react/miscellaneous/database/init.sql
To build the React application follow the following steps:
- open a terminal
- navigate to
nfl-stats-react/src/webapp
- install react dependencies with this command
yarn install
(you only have to do this once) - run the following command
yarn build
Next build the Spring Boot application with these steps:
- open a terminal
- navigate to
nfl-stats-react/
- run the following command
./gradlew clean build
Once the application is built you can run it with the following command:
- In the terminal from the same location you ran the build from
- run the following command
./gradlew boot-run
- navigate to the application
NOTE: You can also build and run the application from IntelliJ