The MyDiary project is a web application that consists of two main components:
-
MyDiary REST API: This component handles API requests, connects to a MySQL database, and provides the backend services. It runs on a server at port
8080
. -
MyDiary REST Client: This component handles the frontend logic, interacting with the REST API. The frontend runs on a separate server at port
8181
.
Both components run in parallel on different servers, with the REST API built using Spring Boot and the frontend built with Java and JSP.
- Technology: Spring Boot, JPA, MySQL
- Responsibilities:
- Handle API requests
- Interact with the MySQL database for CRUD operations
- Run on port
8080
- Technology: JSP, HTML, JavaScript
- Responsibilities:
- Frontend UI
- Send API requests to the MyDiary REST API
- Run on port
8181
This project is split across two development environments:
- Spring Tool Suite (IDE): Used to develop the MyDiary REST API.
- Eclipse IDE: Used to develop the MyDiary REST Client.
Each environment has a dedicated server running on different ports:
- MyDiary REST API: Runs on port
8080
- MyDiary REST Client: Runs on port
8181
- Navigate to the
MyDiary-REST-API
folder in Spring Tool Suite. - Run the application.
- The application will start on port
8080
and interact with the MySQL database.
- Navigate to the
MyDiary-REST-Client
folder in Eclipse IDE. - Run the application.
- The application will start on port
8181
and send API requests tohttp://localhost:8080/
.
- Java 17+
- Spring Boot
- MySQL
- Maven
-
Clone the repository:
git clone https://github.com/SVKREP/MyDiary-RESTClient-and-RESTAPI.git
-
Setup MySQL:
- Create a MySQL database and configure the connection in the
application.properties
file of the REST API.
- Create a MySQL database and configure the connection in the
-
Build and Run:
- For REST API:
mvn spring-boot:run
- For REST Client: Deploy the project in Eclipse or use
mvn jetty:run
if configured.
- For REST API:
Here are the main API endpoints in the MyDiary REST API for entries:
GET /entries
: Fetch all entriesPOST /entries
: Add a new entryPUT /entries/{id}
: Update an existing entryDELETE /entries/{id}
: Delete an entry
These are the user-related API endpoints in the MyDiary REST API:
GET /users
: Fetch all usersGET /users/{id}
: Fetch a user by IDPOST /users
: Register a new userPUT /users/{id}
: Update an existing userDELETE /users/{id}
: Delete a user by ID
This project uses the following design principles:
- Separation of Concerns: The MyDiary REST API handles the business logic and database interactions, while the REST Client manages user interactions.
- Parallel Server Setup: The REST API and REST Client run on separate servers and ports (
8080
and8181
), ensuring modularity and flexibility in development and deployment.
This project is licensed under the MIT License.