Skip to content

TR-1000/trivia-app-backend

Repository files navigation

Trivia-API

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.

Entity Relationship Diagram
ERD

Running the API

To run the project you will need:

To install the project to you to local machine:

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;

Roadmap

  • Parse questions from the triva_data.json file and add them to the database programmatically.

  • Password hashing

  • More logging

Challenges

  • 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.

About

api for a trivia web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages