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 2885cb7

Browse files
author
Ivan Franchin
committed
Project upgrade
- Upgrade to spring-boot 3.2.5; - Upgrade to springdoc-openapi 2.5.0; - 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 b4203a9 commit 2885cb7

File tree

5 files changed

+11253
-7610
lines changed

5 files changed

+11253
-7610
lines changed

‎README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# springboot-react-basic-auth
22

3-
The goal of this project is to implement an application called `book-app` to manage books. For it, we will implement a back-end [`Spring Boot`](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/) application called `book-api` and a font-end [React](https://react.dev/) application called `book-ui`. Besides, we will use [`Basic Authentication`](https://en.wikipedia.org/wiki/Basic_access_authentication) to secure both applications.
3+
The goal of this project is to implement an application called `book-app` to manage books. For it, we will implement a back-end [`Spring Boot`](https://spring.io/projects/spring-boot) application called `book-api` and a font-end [React](https://react.dev/) application called `book-ui`. Besides, we will use [`Basic Authentication`](https://en.wikipedia.org/wiki/Basic_access_authentication) to secure both applications.
44

55
## Proof-of-Concepts & Articles
66

@@ -27,7 +27,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
2727

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

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

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

6060
## Start Environment
6161

62-
- In a terminal, make sure you are inside `springboot-react-basic-auth` root folder
62+
- In a terminal, make sure you are inside `springboot-react-basic-auth` root folder;
6363

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

7171
- **book-api**
7272

73-
- Open a terminal and navigate to `springboot-react-basic-auth/book-api` folder
73+
- Open a terminal and navigate to `springboot-react-basic-auth/book-api` folder;
7474

75-
- Run the following `Maven` command to start the application
75+
- Run the following `Maven` command to start the application:
7676
```
7777
./mvnw clean spring-boot:run
7878
```
7979
8080
- **book-ui**
8181
82-
- Open another terminal and navigate to `springboot-react-basic-auth/book-ui` folder
82+
- Open another terminal and navigate to `springboot-react-basic-auth/book-ui` folder;
8383
84-
- Run the command below if you are running the application for the first time
84+
- Run the command below if you are running the application for the first time:
8585
```
8686
npm install
8787
```
8888
89-
- Run the `npm` command below to start the application
89+
- Run the `npm` command below to start the application:
9090
```
9191
npm start
9292
```
@@ -102,31 +102,31 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
102102
103103
## Demo
104104
105-
- The gif below shows a `user` loging in
105+
- The gif below shows a `user` loging in:
106106
107107
![user-login](documentation/user-login.gif)
108108
109-
- The gif below shows an `admin` loging in
109+
- The gif below shows an `admin` loging in:
110110
111111
![admin-login](documentation/admin-login.gif)
112112
113113
## Testing book-api Endpoints
114114
115115
- **Manual Endpoints Test using Swagger**
116116
117-
- 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 `username` and `password` credentials.
117+
- 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 `username` and `password` credentials;
118118
119-
- Click `Authorize` button (white/green one, almost at the top of the page, right side)
119+
- Click `Authorize` button (white/green one, almost at the top of the page, right side);
120120
121-
- In the `Basic authentication` form that will open, provide the `admin` credentials (`admin/admin`) or `user` ones (`user/user`). Then, click `Authorize` and, finally, click `Close` button.
121+
- In the `Basic authentication` form that will open, provide the `admin` credentials (`admin/admin`) or `user` ones (`user/user`). Then, click `Authorize` and, finally, click `Close` button;
122122
123-
- Make some call to the endpoints
123+
- Make some call to the endpoints.
124124
125125
- **Manual Endpoints Test using curl**
126126
127-
- Open a terminal
127+
- Open a terminal:
128128
129-
- Call `GET /public/numberOfBooks`
129+
- Call `GET /public/numberOfBooks`:
130130
```
131131
curl -i localhost:8080/public/numberOfBooks
132132
```
@@ -136,21 +136,21 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
136136
70
137137
```
138138
139-
- Call `GET /api/books` without credentials
139+
- Call `GET /api/books` without credentials:
140140
```
141141
curl -i localhost:8080/api/books
142142
```
143-
As this endpoint requires authentication, it should return
143+
As this endpoint requires authentication, it should return:
144144
```
145145
HTTP/1.1 401
146146
{ "timestamp": "...", "status": 401, "error": "Unauthorized", "message": "Unauthorized", "path": "/api/books" }
147147
```
148148
149-
- Call again `GET /api/books` but now with `user` credentials
149+
- Call again `GET /api/books` but now with `user` credentials:
150150
```
151151
curl -i -u user:user localhost:8080/api/books
152152
```
153-
It should return
153+
It should return:
154154
```
155155
HTTP/1.1 200
156156
[
@@ -160,37 +160,37 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
160160
]
161161
```
162162
163-
- Call `POST /api/books` with `user` credentials
163+
- Call `POST /api/books` with `user` credentials:
164164
```
165165
curl -i -u user:user -X POST localhost:8080/api/books \
166166
-H "Content-Type: application/json" -d '{"isbn": "9781617292545", "title": "Spring Boot in Action"}'
167167
```
168-
As `user` doesn't have the role `ADMIN`, it should return
168+
As `user` doesn't have the role `ADMIN`, it should return:
169169
```
170170
HTTP/1.1 403
171171
{ "timestamp": "...", "status": 403, "error": "Forbidden", "message": "Forbidden", "path": "/api/books" }
172172
```
173173
174-
- Call `POST /api/books` with `admin` credentials
174+
- Call `POST /api/books` with `admin` credentials:
175175
```
176176
curl -i -u admin:admin -X POST localhost:8080/api/books \
177177
-H "Content-Type: application/json" -d '{"isbn": "9781617292545", "title": "Spring Boot in Action"}'
178178
```
179-
It should return
179+
It should return:
180180
```
181181
HTTP/1.1 201
182182
{ "isbn":"9781617292545","title":"Spring Boot in Action" }
183183
```
184184
185185
- **Automatic Endpoints Test**
186186
187-
- Open a terminal and make sure you are in `springboot-react-basic-auth` root folder
187+
- Open a terminal and make sure you are in `springboot-react-basic-auth` root folder;
188188
189-
- Run the following script
189+
- Run the following script:
190190
```
191191
./book-api/test-endpoints.sh
192192
```
193-
It should return something like the output below, where it shows the http code for different requests
193+
It should return something like the output below, where it shows the http code for different requests:
194194
```
195195
POST auth/authenticate
196196
======================
@@ -233,18 +233,18 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
233233
234234
## Shutdown
235235
236-
- To stop `book-api` and `book-ui`, go to the terminals where they are running and press `Ctrl+C`
236+
- To stop `book-api` and `book-ui`, go to the terminals where they are running and press `Ctrl+C`;
237237
238-
- To stop and remove docker compose containers, network and volumes, go to a terminal and, inside `springboot-react-basic-auth` root folder, run the command below
238+
- To stop and remove docker compose containers, network and volumes, go to a terminal and, inside `springboot-react-basic-auth` root folder, run the command below:
239239
```
240240
docker compose down -v
241241
```
242242
243243
## How to upgrade book-ui dependencies to latest version
244244
245-
- In a terminal, make sure you are in `springboot-react-basic-auth/book-ui` folder
245+
- In a terminal, make sure you are in `springboot-react-basic-auth/book-ui` folder;
246246
247-
- Run the following commands
247+
- Run the following commands:
248248
```
249249
npm upgrade
250250
npm i -g npm-check-updates

‎book-api/pom.xml

Lines changed: 2 additions & 2 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,7 +16,7 @@
1616

1717
<properties>
1818
<java.version>17</java.version>
19-
<springdoc-openapi.version>2.3.0</springdoc-openapi.version>
19+
<springdoc-openapi.version>2.5.0</springdoc-openapi.version>
2020
</properties>
2121

2222
<dependencies>

0 commit comments

Comments
(0)

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