Skip to content

Commit f185a20

Browse files
committed
docker mysql -v 8
1 parent b12c3c0 commit f185a20

File tree

2 files changed

+59
-156
lines changed

2 files changed

+59
-156
lines changed

README.md

Lines changed: 49 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
32
<b>ReactJS-Spring-Boot-Full-Stack-App</b>
43
<hr>
54

@@ -27,136 +26,6 @@ spring-backend stores its data in a MySql database.
2726

2827
spring-backend has the following endpoints
2928

30-
<table>
31-
<tbody>
32-
<tr class="odd">
33-
<td><b>Endpoint</b></td>
34-
<td><b>Secured</b></td>
35-
<td><b>Roles</b></td>
36-
</tr>
37-
<tr class="even">
38-
<td>POST /users/authenticate</td>
39-
<td>NO</td>
40-
<td>USER and BUSINESS</td>
41-
</tr>
42-
<tr class="odd">
43-
<td><p>POST /hobbies/create-offer</p>
44-
<p>{“name”,”slogan”, “category”, “intro”, “description”,”price”,”creator”,”location”,”profileImgUrl”,”galleryImgUrl1”,</p>
45-
<p>“galleryImgUrl2”,”galleryImgUrl3”,</p>
46-
<p>“contactInfo”</p>
47-
<p>}</p></td>
48-
<td>YES</td>
49-
<td>BUSINESS</td>
50-
</tr>
51-
<tr class="even">
52-
<td>DELETE /hobbies/delete-hobby/{sbdbId}</td>
53-
<td>YES</td>
54-
<td>BUSINESS</td>
55-
</tr>
56-
<tr class="odd">
57-
<td>GET /user-home/{sbdbUsername}</td>
58-
<td>YES</td>
59-
<td>USER</td>
60-
</tr>
61-
<tr class="even">
62-
<td>GET /hobbies/hobby-details/{sbdbId}</td>
63-
<td>YES</td>
64-
<td>USER and BUSINESS</td>
65-
</tr>
66-
<tr class="odd">
67-
<td>GET /hobbies/is-saved {“id”, “username”}</td>
68-
<td>YES</td>
69-
<td>USER</td>
70-
</tr>
71-
<tr class="even">
72-
<td>GET /hobbies/saved-hobbies/{sbdbUsername}</td>
73-
<td>YES</td>
74-
<td>USER</td>
75-
</tr>
76-
<tr class="odd">
77-
<td>GET /business-owner/{sbdbUsername}</td>
78-
<td>YES</td>
79-
<td>BUSINESS</td>
80-
</tr>
81-
<tr class="even">
82-
<td>GET /hobbies/remove-hobby {“id”, “username”}</td>
83-
<td>YES</td>
84-
<td>USER</td>
85-
</tr>
86-
<tr class="odd">
87-
<td>GET /hobbies/remove-hobby {“id”, “username”}</td>
88-
<td>YES</td>
89-
<td>USER</td>
90-
</tr>
91-
<tr class="even">
92-
<td><p>PUT /hobbies/update-hobby </p>
93-
<p>{“name”,”slogan”, “category”, “intro”,</p>
94-
<p>“description”,”price”,”creator”,”location”,”profileImgUrl”,”galleryImgUrl1”,</p>
95-
<p>“galleryImgUrl2”,”galleryImgUrl3”,</p>
96-
<p>“contactInfo”, “id”</p>
97-
<p>}</p></td>
98-
<td>YES</td>
99-
<td>BUSINESS</td>
100-
</tr>
101-
<tr class="odd">
102-
<td>POST /users/login/{sbdbUsername} </td>
103-
<td>YES</td>
104-
<td>USER and BUSINESS</td>
105-
</tr>
106-
<tr class="even">
107-
<td><p>POST /test/results {“categoryOne”,” categoryTwo”, “categoryThree”, “ categoryFour”,” categoryFive”, “ categorySix”, “ categorySeven”, “location”</p>
108-
<p>}</p></td>
109-
<td>YES</td>
110-
<td>USER</td>
111-
</tr>
112-
<tr class="odd">
113-
<td>POST /users/change-password {“email”}</td>
114-
<td><p>NO</p></td>
115-
<td>USER and BUSINESS</td>
116-
</tr>
117-
<tr class="even">
118-
<td>POST /users/change-password-new {“id”, “username”}</td>
119-
<td><p>NO </p>
120-
<p>(link from Email)</p></td>
121-
<td>USER and BUSINESS</td>
122-
</tr>
123-
<tr class="odd">
124-
<td>POST /users/register-business {“username”,”businessname”, “address”, “email”,”password”, “repeatpassword”}</td>
125-
<td>NO</td>
126-
<td>BUSINESS</td>
127-
</tr>
128-
<tr class="even">
129-
<td>POST /users/rsignup {“username”,”fullName”, “gender”, “email”,”password”, “repeatpassword”}</td>
130-
<td>NO</td>
131-
<td>USER</td>
132-
</tr>
133-
<tr class="odd">
134-
<td>GET users/show-business-details/{sbdbUsername}</td>
135-
<td>YES</td>
136-
<td>BUSINESS</td>
137-
</tr>
138-
<tr class="even">
139-
<td>DELETE users/delete-user/{sbdbId}</td>
140-
<td>YES</td>
141-
<td>USER and BUSINESS</td>
142-
</tr>
143-
<tr class="odd">
144-
<td>PUT users/update-business {”businessname”, “address”,”password”, “id”}</td>
145-
<td>YES</td>
146-
<td>BUSINESS</td>
147-
</tr>
148-
<tr class="even">
149-
<td>PUT users/update-USER {,”fullName”, “gender”, ”password”, “id”}</td>
150-
<td>YES</td>
151-
<td>USER</td>
152-
</tr>
153-
<tr class="odd">
154-
<td>GET users/show-client-details/{sbdbUsername}</td>
155-
<td>YES</td>
156-
<td>USER</td>
157-
</tr>
158-
</tbody>
159-
</table>
16029

16130
<b>-react-frontend</b>
16231

@@ -177,37 +46,71 @@ react-frontend uses Semantic UI React as CSS-styled framework.
17746

17847
<hr></hr>
17948

180-
Install NodeJs.
49+
Clone the repository:
50+
51+
<pre>git clone https://github.com/purshink/ReactJS-Spring-Boot-Full-Stack-App.git</pre>
52+
53+
Navigate to the newly created folder:
54+
55+
<pre>cd ReactJS-Spring-Boot-Full-Stack-App</pre>
56+
18157

18258
<b>Frontend -</b>
18359

60+
Install NodeJs.v.16.13.1 /npm v.8.3.0
61+
62+
Navigate to react-frontend subfolder:
63+
64+
<pre>cd react-frontend</pre>
18465

185-
<pre>Open ./react-frontend</pre>
66+
Install the modules
18667

187-
<pre>Install the modules - npm i</pre>
68+
<pre>npm i</pre>
18869

189-
<pre>Start the application on local host - npm start</pre>
70+
Start the application on local host:
19071

191-
<pre>The application will run on http://localhost:4200</pre>
72+
<pre>npm start</pre>
19273

193-
-React JS
74+
Navigate to:
19475

195-
-Axios - API Calls
76+
http://localhost:4200
19677

78+
19779
<b>Backend -</b>
19880
Install JDK 11.0.11
81+
Install docker -v 20.10.7
82+
Install docker-compose -v 1.8.0
19983

200-
<pre>Open ./spring-backend on any IDE (IntelliJ/Eclipse etc.) and run the application.</pre>
84+
Navigate to spring-backend subfolder:
85+
86+
<pre>cd spring-backend</pre>
87+
88+
Run the project with:
89+
90+
<pre>docker-compose up --build</pre>
20191

202-
<pre>The backend will run on http://localhost:8080 </pre>
20392

204-
-Spring Boot
93+
The project has the following endpoints:
94+
95+
http://localhost:8080/swagger-ui/index.html
96+
97+
IMPORTANT: to explore api enter url: /v3/api-docs
98+
99+
NOTE: Testing API
100+
101+
-/signup (create client-user) or /register (create business-user)
102+
103+
-/authenticate (returns JWT authentication token)
104+
105+
-use JWT token in order to authorize access to secured endpoints (click the lock icon or use the Authorize button on the upper right corner - then paste JWT Token )
106+
107+
NOTE: /notification endpoint will return an internal server error if you don't specify spring.mail credentials first.
108+
109+
<pre>The backend will run on http://localhost:8080 </pre>
205110

206-
-Basic Authentication and JWT implemented both using Spring Security.
111+
<b>Spring Mail</b>
207112

208-
-Spring Data JPA + MySQL
113+
Make sure to specify a valid spring.mail.username and spring.mail.password in the application.properties file in order to be able to send an Email confirmation for updating user entries.
209114

210-
<b>Database -</b>
115+
IMPORTANT: if you decide not to specify mail credentials, you will get javax.mail.AuthenticationFailedException. The rest of the application should work normally despite this exception.
211116

212-
Make sure to specify spring.datasource.username and spring.datasource.password in the application.properties file.
213-
The databse will be created with the start of the application. No set up required.

spring-backend/docker-compose.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
version: "2"
22

33
services:
4+
mysqldb:
5+
image: mysql:8-oracle
6+
7+
networks:
8+
- springmysql-net
9+
environment:
10+
- MYSQL_ROOT_PASSWORD=1
11+
- MYSQL_DATABASE=hobbie_backend_db
12+
413
spring-backend:
514
image: spring-backend
615
build:
@@ -9,20 +18,11 @@ services:
918
ports:
1019
- "8080:8080"
1120
environment:
12-
- spring.datasource.url=jdbc:mysql://mysqldb:3306/hobbie_backend_db?useSSL=false
21+
- spring.datasource.url=jdbc:mysql://mysqldb:3306/hobbie_backend_db?useSSL=false&serverTimezone=Europe/Paris
1322
networks:
1423
- springmysql-net
1524
depends_on:
1625
- mysqldb
1726

18-
mysqldb:
19-
image: mysql:5.7
20-
21-
networks:
22-
- springmysql-net
23-
environment:
24-
- MYSQL_ROOT_PASSWORD=1
25-
- MYSQL_DATABASE=hobbie_backend_db
26-
2727
networks:
2828
springmysql-net:

0 commit comments

Comments
 (0)