Requirements:
- 1. HTTP Client (browser) allows user enter URL and send request to HTTP Server. HTTP Server will send to
HTTP Client the file requested. The file can be a simple file (txt file) (4 points) - 2. If the requested file is not found, Server response status code 404. (1 points)
- 3. HTTP Client must have a simple GUI to show the content of file (2 points)
- 4. Your grade is added +1/10 if your server program supports many clients simultaneously.
- 5. Your HTTP system supports POST method, +1/10 will be added into your grade.
- 6. Your HTTP system supports DELETE method, +1/10 will be added into your grade.
Total points: 10/10
This project is a basic web application that uses PostgreSQL for the database, Spring Boot for the backend, and a JavaScript framework for the frontend. Follow the steps below to set up and run the project on your local machine.
- PostgreSQL
- Java (JDK 8 or later)
- Node.js and npm
- Install PostgreSQL if you haven't already.
- Open PostgreSQL and create a new database named
data_jpa
.
git clone <repository-url>
cd <repository-directory>
- Open intellij File -> Project Structure -> Download JDK -> Version 17 -> Vendor: Amazone Corretto -> Download
- Open the application.yaml file located in the src/main/resources directory.
- Update the database configuration section with your PostgreSQL credentials.
- Update address to your ipv4
spring:
datasource:
url: jdbc:postgresql://localhost:5432/data_jpa
username: postgres
password: change_your_password_here
jpa:
hibernate:
ddl-auto: create-drop
database: postgresql
show-sql: true
server:
error:
include-message: always
address: 'change_your_ipv4_here'
- Navigate to the backend directory and install mvn:
cd backend
mvn clean install
- Run the backend:
java -jar target/jpa-0.0.1-SNAPSHOT.jar
To allow multiple client to connect to the server, you have to adjust the ipv4 address according to your server
- FileDeleter.jsx
axios.delete(`http://localhost:8080/files/delete/${fileName}`) // change your ipv4 here
- FileSearch.jsx
axios.get(`http://localhost:8080/files/search/${fileName}`) //change your ipv4 here
- FileUploader.jsx
axios.post('http://localhost:8080/files/upload', formData, { // change your ipv4 here
- vite.config.js
server: {
host: 'change_your_ipv4_here',
port: 3000
}
- Open a new terminal window.
- Navigate to the frontend directory and install npm:
cd frontend
npm install
- Start the frontend development server:
npm run dev