- Download & install Java 17
- Download & install any Maven version that is compatible with Java 17
- Download & install your preferred IDE (Eclipse, VSCode, IntelliJ)
- Download & install the latest version of Postman
- Ensure you have an application.properties file in /src/main/resources
- Add system environment variables. Ask Derek for these variables.
- ${MONGODB_URL}
- ${SPRING_MAIL_PASSWORD}
- ${SPRING_MAIL_USERNAME}
- ${AWS_ACCESS_KEY}
- ${AWS_SECRET_KEY}
- ${INTERQU_API_KEY}
- ${GET_EXPRESSION_API_URL}
- If not already done, create an /interqu folder to store all interqu related projects
- Under the /interqu folder, git clone https://github.com/Interqu/interqu-release.git
- Open up the project in your prefered IDE
- In Eclipse/STS right click on the InterquReleaseApplication.java, and select: Run As > Spring Boot App
- For cmd users, go to root directory of the app, and run "mvn clean install" to build, then run "mvn spring-boot:run" to start the app.
- Create a method within the appropriate API class
- Decide on its mapping type and create a URI for it
- If returning some data, create a response object for it and return it inside of the endpoint. It will automatically be converted to JSON
- If you need some sort of user data, user SecurityContextHolder to get the current authenticated user.
- By default, all endpoints are authenticated automatically. If this endpoint shouldnt be authenticated, please add it in the CustomWebConfig class.
- Test your endpoint using PostMan
We are using MongoDB Atlas. It is hosted on an AWS server and is completely remote for development purposes. Heres how to create new tables/fields
- If you wish to create a new table, first create an object to describe what the fields are
- Create a interface - see the com.interqu.db package for more details
- Send a .save request and check MongoDB Atlas to see if the data has been successfully stored.
All of the backend api endpoints are listed under ${BACKEND_URL}/api/${ENDPOINT_TYPE}/${ENDPOINT_URI}, where BACKEND_URL is the base url to the backend server. The ${ENDPOINT_TYPE} consists of either /user, /interview, or /admin. Then ${ENDPOINT_URL} is the specific endpoint you are trying to reach. i.e. /getInterviewResults.
Put in 'Content-Type': 'application/json' in headers.
For all API request to backend, other than /user/authenticate or /user/register, must be authenticated.
To be authenticated, put the following header 'Authorization': 'Bearer + ${JWT_TOKEN}'.
Some API endpoints requires a payload. Please refer to the java object for the specific format, or ask Derek.
Below is a sample docker-compose.yml configuration for creating the container.
---
version: "3.8"
services:
interqu-spring-boot:
container_name: interqu-fe
image: lefanhu/interqu-spring-boot:latest
stdin_open: true
tty: true
restart: unless-stopped
ports:
- '8080:8080'
env_file:
- './.env'