This API is for managing users and trivia questions. This API could be used to build a front end for a web application version of this simple console trivia game.
- Players can register and login.
- Players can view and update their information and also delete their account.
- Logged in players can create/play a round of trivia.
- Only a current admin can create another admin account, but admin cannot create a player account.
- Admins can both view all player information, as well as update and delete a players account.
- Administrators can view all questions and their potential answers.
- Anyone can view rounds played by an individual player or all players.
Documentation for making requests to the API can be found here.
To run the project you will need:
- Java SE Development Kit 8
- Eclipse or code editor of your choice
- Apache Maven
- Tomcat v8.5 Server
- PostgreSQL or your preferred RDBMS
- Postman API Testing Tool
To install the project to you to local machine:
-
Download project source code and unzip it into a folder location.
-
In the src/main/java/utilities/ConnectionUtil.java file change
String username
andString password
to your credentials:
public class ConnectionUtil {
public static Connection getConnection() throws SQLException {
try {
//Lets Tomcat see where the driver is
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
String url = "jdbc:postgresql://localhost:5432/trivia";
String username = {{yourPostgresUsername}};
String password = {{yourPassword}};
return DriverManager.getConnection(url, username, password);
}
}
- Create a database named "trivia"
CREATE DATABASE trivia;
-
Run the scripts in the SQL directory to create the tables. Seed the database with the provided scripts. The questions and answers data can be added using the scripts or by running the main method in src/main/java/utilities/QuestionsBootstrapper.java
-
Parse questions from the triva_data.json file and add them to the database programmatically. -
Password hashing
-
More logging
-
Encountered some issues with Java code not saving after editing in Atom.
-
Currently there is code for adding questions and answers to the database and access them from the API, but that code isn't working properly yet.It's working now.