You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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.
Copy file name to clipboardExpand all lines: README.md
+32-32Lines changed: 32 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# springboot-react-basic-auth
2
2
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.
4
4
5
5
## Proof-of-Concepts & Articles
6
6
@@ -27,7 +27,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
27
27
28
28
`book-api` stores its data in [`Postgres`](https://www.postgresql.org/) database.
@@ -59,9 +59,9 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
59
59
60
60
## Start Environment
61
61
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;
63
63
64
-
- Run the following command to start docker compose containers
64
+
- Run the following command to start docker compose services:
65
65
```
66
66
docker compose up -d
67
67
```
@@ -70,23 +70,23 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
70
70
71
71
-**book-api**
72
72
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;
74
74
75
-
- Run the following `Maven` command to start the application
75
+
- Run the following `Maven` command to start the application:
76
76
```
77
77
./mvnw clean spring-boot:run
78
78
```
79
79
80
80
- **book-ui**
81
81
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;
83
83
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:
85
85
```
86
86
npm install
87
87
```
88
88
89
-
- Run the `npm` command below to start the application
89
+
- Run the `npm` command below to start the application:
90
90
```
91
91
npm start
92
92
```
@@ -102,31 +102,31 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
102
102
103
103
## Demo
104
104
105
-
- The gif below shows a `user` loging in
105
+
- The gif below shows a `user` loging in:
106
106
107
107

108
108
109
-
- The gif below shows an `admin` loging in
109
+
- The gif below shows an `admin` loging in:
110
110
111
111

112
112
113
113
## Testing book-api Endpoints
114
114
115
115
- **Manual Endpoints Test using Swagger**
116
116
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;
118
118
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);
120
120
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;
122
122
123
-
- Make some call to the endpoints
123
+
- Make some call to the endpoints.
124
124
125
125
- **Manual Endpoints Test using curl**
126
126
127
-
- Open a terminal
127
+
- Open a terminal:
128
128
129
-
- Call `GET /public/numberOfBooks`
129
+
- Call `GET /public/numberOfBooks`:
130
130
```
131
131
curl -i localhost:8080/public/numberOfBooks
132
132
```
@@ -136,21 +136,21 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
136
136
70
137
137
```
138
138
139
-
- Call `GET /api/books` without credentials
139
+
- Call `GET /api/books` without credentials:
140
140
```
141
141
curl -i localhost:8080/api/books
142
142
```
143
-
As this endpoint requires authentication, it should return
143
+
As this endpoint requires authentication, it should return:
{ "isbn":"9781617292545","title":"Spring Boot in Action" }
183
183
```
184
184
185
185
- **Automatic Endpoints Test**
186
186
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;
188
188
189
-
- Run the following script
189
+
- Run the following script:
190
190
```
191
191
./book-api/test-endpoints.sh
192
192
```
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:
194
194
```
195
195
POST auth/authenticate
196
196
======================
@@ -233,18 +233,18 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
233
233
234
234
## Shutdown
235
235
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`;
237
237
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:
239
239
```
240
240
docker compose down -v
241
241
```
242
242
243
243
## How to upgrade book-ui dependencies to latest version
244
244
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;
0 commit comments