Dog raising simulator using SpringBoot to create RESTful APIs. Inspired by online anmal raising games like Neopets and Webkinz.
This section explains how to run DogSpring using Gradle.
- Clone this repository
- Navigate to this project's root directory and run
./gradlew bootrun - DogSpring should be running on http://127.0.0.1:8080/
Follow these steps if you want to connect this program to a PostgreSQL database instead of the default list implementation.
-
Create the "dog-spring" database using pgAdmin.
-
Create the dogs and users tables within the dog-spring database
The two following commands should be run:-
For dog table:
CREATE TABLE dogs ( id UUID PRIMARY KEY NOT NULL, name VARCHAR(50) NOT NULL, happiness INTEGER DEFAULT 100, energy INTEGER DEFAULT 100, hunger INTEGER DEFAULT 0, imgLink VARCHAR(200) NOT NULL, birthdate TIMESTAMP, ownerUsername VARCHAR(50) ) -
For user table:
CREATE TABLE users ( username VARCHAR(50) PRIMARY KEY NOT NULL UNIQUE, displayName VARCHAR(50) NOT NULL, ownedDogIDs UUID[], gold INTEGER DEFAULT 0, lastDogRequest timestamp with time zone )
-
-
Navigate to src/main/resources/application.properties and input the appropriate datasource url, username and password for your installation
-
Change the source code datasources by going to src/main/java/io/github/jdrolet/dogspring/service and changing the appropriate qualifiers
- Change "fakeDogDao" to "postgresDogDao" in DogService.java and change "fakeUserDao" to "postgresUserDao" in UserService.java
-
Run the program as normal using
./gradlew bootrun
Dog images are provided courtesy of the Dog CEO Dog API.
This project was created by me to furthur my understanding of SpringBoot, RESTful APIs, Databases and software architecture. DogSpring was motivated as being a jumping off point for furthur development and technologies. Possible expansions include
- Implementing authentication for users
- Adding more complicated game mechanics
- Trading with other users