Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d45cc5b

Browse files
author
Ivan Franchin
committed
Project upgrade
- Upgrade to spring-boot 3.2.5; - Upgrade to springdoc-openapi 2.5.0; - Upgrade to jjwt 0.12.5; - Upgrade to react 18.3.1; - Upgrade to react-dom 18.3.1; - Upgrade to axios 1.6.8; - Upgrade to react-router-dom 6.23.0; - Upgrade to postgres docker image 16.1; - Remove obsolete version field in docker-compose.yml; - Update README.
1 parent 109471a commit d45cc5b

File tree

5 files changed

+11263
-7620
lines changed

5 files changed

+11263
-7620
lines changed

‎README.md‎

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
2727

2828
`order-api` stores its data in [`Postgres`](https://www.postgresql.org/) database.
2929

30-
`order-api` has the following endpoints
30+
`order-api` has the following endpoints:
3131

3232
| Endpoint | Secured | Roles |
3333
| ------------------------------------------------------------- | ------- | --------------- |
@@ -60,9 +60,9 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
6060

6161
## Start Environment
6262

63-
- In a terminal, make sure you are inside `springboot-react-jwt-token` root folder
63+
- In a terminal, make sure you are inside `springboot-react-jwt-token` root folder;
6464

65-
- Run the following command to start docker compose containers
65+
- Run the following command to start docker compose services:
6666
```
6767
docker compose up -d
6868
```
@@ -71,23 +71,23 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
7171

7272
- **order-api**
7373

74-
- Open a terminal and navigate to `springboot-react-jwt-token/order-api` folder
74+
- Open a terminal and navigate to `springboot-react-jwt-token/order-api` folder;
7575

76-
- Run the following `Maven` command to start the application
76+
- Run the following `Maven` command to start the application:
7777
```
7878
./mvnw clean spring-boot:run
7979
```
8080
8181
- **order-ui**
8282
83-
- Open another terminal and navigate to `springboot-react-jwt-token/order-ui` folder
83+
- Open another terminal and navigate to `springboot-react-jwt-token/order-ui` folder;
8484
85-
- Run the command below if you are running the application for the first time
85+
- Run the command below if you are running the application for the first time:
8686
```
8787
npm install
8888
```
8989
90-
- Run the `npm` command below to start the application
90+
- Run the `npm` command below to start the application:
9191
```
9292
npm start
9393
```
@@ -99,56 +99,56 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
9999
| order-api | http://localhost:8080/swagger-ui.html | |
100100
| order-ui | http://localhost:3000 | `admin/admin`, `user/user` or signing up a new user |
101101
102-
> **Note**: the credentials shown in the table are the ones already pre-defined. You can signup new users
102+
> **Note**: the credentials shown in the table are the ones already pre-defined. You can signup new users.
103103
104104
## Demo
105105
106-
- The gif below shows a `user` loging in
106+
- The gif below shows a `user` loging in:
107107
108108
![user-login](documentation/user-login.gif)
109109
110-
- The gif below shows an `admin` loging in
110+
- The gif below shows an `admin` loging in:
111111
112112
![admin-login](documentation/admin-login.gif)
113113
114114
## Testing order-api Endpoints
115115
116116
- **Manual Endpoints Test using Swagger**
117117
118-
- Open a browser and access http://localhost:8080/swagger-ui.html. All endpoints with the lock sign are secured. In order to access them, you need a valid JWT access token.
118+
- Open a browser and access http://localhost:8080/swagger-ui.html. All endpoints with the lock sign are secured. In order to access them, you need a valid JWT access token;
119119
120-
- Click `POST /auth/authenticate` and then, click `Try it out` button
120+
- Click `POST /auth/authenticate` and then, click `Try it out` button;
121121
122-
- Provide the `user` credentials `username` and `password`
122+
- Provide the `user` credentials `username` and `password`:
123123
```
124124
{ "password": "user", "username": "user" }
125125
```
126126
127-
- Click `Execute` button. It should return something like
127+
- Click `Execute` button. It should return something like:
128128
```
129129
Code: 200
130130
{ "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9..." }
131131
```
132-
> **Note 1**: You can use the `admin` credentials to access more secured endpoints
132+
> **Note 1**: You can use the `admin` credentials to access more secured endpoints.
133133
>
134-
> **Note 2**: The token will expire in **10 minutes**
134+
> **Note 2**: The token will expire in **10 minutes**.
135135
136-
- Copy the `accessToken` value (**without** the double quotes)
136+
- Copy the `accessToken` value (**without** the double quotes);
137137
138-
- Click the `Authorize` button at the top of the page
138+
- Click the `Authorize` button at the top of the page;
139139
140-
- In `Value` input field, paste the copied token
140+
- In `Value` input field, paste the copied token;
141141
142-
- Click `Authorize` button and then, click `Close` button
142+
- Click `Authorize` button and then, click `Close` button;
143143
144-
- To create an order, click `POST /api/orders` and then, click `Try it out` button
144+
- To create an order, click `POST /api/orders` and then, click `Try it out` button;
145145
146-
- Provide the `description` of the order
146+
- Provide the `description` of the order:
147147
```
148148
{ "description": "Buy two iPhones" }
149149
```
150150
151-
- Click `Execute` button. It should return something like
151+
- Click `Execute` button. It should return something like:
152152
```
153153
Code: 200
154154
{
@@ -161,49 +161,49 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
161161
162162
- **Manual Endpoints Test using curl**
163163
164-
- Open a terminal
164+
- Open a terminal;
165165
166-
- Call `GET /public/numberOfUsers`
166+
- Call `GET /public/numberOfUsers`:
167167
```
168168
curl -i localhost:8080/public/numberOfUsers
169169
```
170-
It should return
170+
It should return:
171171
```
172172
HTTP/1.1 200
173173
2
174174
```
175175
176-
- Call `GET /api/orders` without JWT access token
176+
- Call `GET /api/orders` without JWT access token:
177177
```
178178
curl -i localhost:8080/api/orders
179179
```
180-
As for this endpoint a valid JWT access token is required, it should return
180+
As for this endpoint a valid JWT access token is required, it should return:
181181
```
182182
HTTP/1.1 401
183183
```
184184
185-
- Call `POST /auth/authenticate` to get `admin` JWT access token
185+
- Call `POST /auth/authenticate` to get `admin` JWT access token:
186186
```
187187
ADMIN_ACCESS_TOKEN="$(curl -s -X POST http://localhost:8080/auth/authenticate \
188188
-H 'Content-Type: application/json' \
189189
-d '{"username": "admin", "password": "admin"}' | jq -r .accessToken)"
190190
```
191191
192-
- Call again `GET /api/orders`, now with `admin` JWT access token
192+
- Call again `GET /api/orders`, now with `admin` JWT access token:
193193
```
194194
curl -i -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" localhost:8080/api/orders
195195
```
196-
It should return an empty array or an array with orders
196+
It should return an empty array or an array with orders:
197197
```
198198
HTTP/1.1 200
199199
[ ... ]
200200
```
201201
202-
- Call `GET /api/users/me` to get more information about the `admin`
202+
- Call `GET /api/users/me` to get more information about the `admin`:
203203
```
204204
curl -i -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" localhost:8080/api/users/me
205205
```
206-
It should return
206+
It should return:
207207
```
208208
HTTP/1.1 200
209209
{
@@ -214,13 +214,13 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
214214
215215
- **Automatic Endpoints Test**
216216
217-
- Open a terminal and make sure you are in `springboot-react-jwt-token` root folder
217+
- Open a terminal and make sure you are in `springboot-react-jwt-token` root folder;
218218
219-
- Run the following script
219+
- Run the following script:
220220
```
221221
./order-api/test-endpoints.sh
222222
```
223-
It should return something like the output below, where it shows the http code for different requests
223+
It should return something like the output below, where it shows the http code for different requests:
224224
```
225225
POST auth/authenticate
226226
======================
@@ -271,18 +271,18 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
271271
272272
## Shutdown
273273
274-
- To stop `order-api` and `order-ui`, go to the terminals where they are running and press `Ctrl+C`
274+
- To stop `order-api` and `order-ui`, go to the terminals where they are running and press `Ctrl+C`;
275275
276-
- To stop and remove docker compose containers, network and volumes, go to a terminal and, inside `springboot-react-jwt-token` root folder, run the command below
276+
- To stop and remove docker compose containers, network and volumes, go to a terminal and, inside: `springboot-react-jwt-token` root folder, run the command below
277277
```
278278
docker compose down -v
279279
```
280280
281281
## How to upgrade order-ui dependencies to latest version
282282
283-
- In a terminal, make sure you are in `springboot-react-jwt-token/order-ui` folder
283+
- In a terminal, make sure you are in `springboot-react-jwt-token/order-ui` folder;
284284
285-
- Run the following commands
285+
- Run the following commands:
286286
```
287287
npm upgrade
288288
npm i -g npm-check-updates

‎docker-compose.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
version: '3.8'
2-
31
services:
42

53
postgres:
6-
image: postgres:15.4
4+
image: postgres:16.1
75
container_name: postgres
86
ports:
97
- "5432:5432"

‎order-api/pom.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-starter-parent</artifactId>
7-
<version>3.2.2</version>
7+
<version>3.2.5</version>
88
<relativePath /> <!-- lookup parent from repository -->
99
</parent>
1010

@@ -16,8 +16,8 @@
1616

1717
<properties>
1818
<java.version>17</java.version>
19-
<jjwt.version>0.12.3</jjwt.version>
20-
<springdoc-openapi.version>2.3.0</springdoc-openapi.version>
19+
<jjwt.version>0.12.5</jjwt.version>
20+
<springdoc-openapi.version>2.5.0</springdoc-openapi.version>
2121
</properties>
2222

2323
<dependencies>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /