This repository contains the code of the AIWS REST Project for the team composed of:
- Camille BRIAND (M1 SE)
- Elodie DEHACHE (M1 SE)
- Jérémi FRIGGIT (M1 IRV)
- Jules LAGNY (M1 SE)
- Zoé NIDDAM (M1 IRV)
The project has been developed using Tomcat 9.0.26 but has also been tested for WildFly 18 and Glassfish 5.
This project relies on a few dependencies (for clearer code, or for features like keywords filtering), so you have to install them and include the libraries in the produced artifact (otherwise, ClassNotFoundException will be thrown by you application server).
The following dependencies were used:
- Jersey and Jackson: JAX-RS Implementation and JSON POJO converter
- HikariCP: Connection pooling library, used for managing database connection pools
- java-jwt: JSON Web Tokens management
- lombok: Clearer POJOs thanks to useful annotations
- bcrypt: Encryption (for password encryption and validation)
- fuzzywuzzy: Fuzzy search features, used for keywords filtering
- mysql-connector-java: JDBC driver for MySQL
WARNING: be sure to include the dependencies jars in the artifact deployed to your application server, otherwise the API won't work
The project is already set to work with our online MySQL database, but if you want to connect your own database, follow these steps
WARNING: These steps assumes that the database you are willing to connect to has already been created thanks to the web/WEB-INF/sql/sql_script.sql
SQL script
- Open the
web/WEB-INF/db.properties
file: this file contains the properties to connect to the database of your choice - Replace the
jdbcUrl
value with the JDBC connection string to your database - Replace the
dbUser
value with the user you want to access your database with, this user must at least have the rights to select, insert, update and delete rows - Replace the
dbPassword
value with the user's password - Replace the
jdbcDriver
value with the classname (complete classname) of the JDBC driver to use to connect to your database
Disclaimer: These steps are important, if you do not follow them, the application will not be able to access your database and will likely crash at startup
Although the project has been developed to work well within a Tomcat 9.0 environment, it should work as well withing WildFly 18 and Glassfish 5 environment
The exposed REST api includes the following endpoints
- /api/auth For authentication purposes
- /api/users For actions related to users
- /api/users/{userId} For actions related to a single user
- /api/books For actions related to books
- /api/books/{bookId} For actions related to a single book
- /api/books/{bookId}/comments For actions related to comments on a book
- /api/books/{bookId}/comments/{commentId} For actions related to a single book comment
- /api/dvds For actions related to dvds
- /api/dvds/{dvdId} For actions related to a single dvd
- /api/dvds/{dvdId}/comments For actions related to comments on a dvd
- /api/dvds/{dvdId}/comments/{commentId} For actions related to a single dvd comment
- /api/video-games For actions related to video-games
- /api/video-games/{videoGameId} For actions related to a single video-game
- /api/video-games/{videoGameId}/comments For actions related to comments on a video-game
- /api/video-games/{videoGameId}/comments/{commentId} For actions related to a single video-game comment
This project does not include unit testing, but all the endpoints have been tested thanks to Postman and its integrated test runner.
We have developed a frontend application using Facebook's React.