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 7cc2f6b

Browse files
author
Ivan Franchin
committed
Update README file
1 parent 61bf6fb commit 7cc2f6b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

‎README.md‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
5454
## Prerequisites
5555

5656
- [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
57-
- [`Java 21+`](https://www.oracle.com/java/technologies/downloads/#java21)
58-
- Some containerization tool [`Docker`](https://www.docker.com/), [`Podman`](https://podman.io/), etc.
57+
- [`Java 21`](https://www.oracle.com/java/technologies/downloads/#java21) or higher;
58+
- A containerization tool (e.g., [`Docker`](https://www.docker.com), [`Podman`](https://podman.io), etc.)
5959
- [`jq`](https://jqlang.github.io/jq/)
6060

6161
## Start Environment
6262

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

6565
- Run the following command to start Docker Compose containers:
66-
```
66+
```bash
6767
docker compose up -d
6868
```
6969

@@ -74,7 +74,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
7474
- Open a terminal and navigate to the `springboot-react-jwt-token/order-api` folder;
7575

7676
- Run the following `Maven` command to start the application:
77-
```
77+
```bash
7878
./mvnw clean spring-boot:run
7979
```
8080

@@ -83,12 +83,12 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
8383
- Open another terminal and navigate to the `springboot-react-jwt-token/order-ui` folder;
8484

8585
- Run the command below if you are running the application for the first time:
86-
```
86+
```bash
8787
npm install
8888
```
8989

9090
- Run the `npm` command below to start the application:
91-
```
91+
```bash
9292
npm start
9393
```
9494

@@ -120,12 +120,12 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
120120
- Click `POST /auth/authenticate` and then, click `Try it out` button;
121121

122122
- Provide the `user` credentials `username` and `password`:
123-
```
123+
```json
124124
{ "password": "user", "username": "user" }
125125
```
126126
127127
- Click the `Execute` button. It should return something like:
128-
```
128+
```text
129129
Code: 200
130130
{ "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9..." }
131131
```
@@ -144,12 +144,12 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
144144
- To create an order, click `POST /api/orders` and then, click the `Try it out` button;
145145
146146
- Provide the `description` of the order:
147-
```
147+
```json
148148
{ "description": "Buy two iPhones" }
149149
```
150150
151151
- Click the `Execute` button. It should return something like:
152-
```
152+
```text
153153
Code: 200
154154
{
155155
"id": "718c9f40-5c06-4571-bc3e-3f888c52eff2",
@@ -164,48 +164,48 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
164164
- Open a terminal;
165165
166166
- Call `GET /public/numberOfUsers`:
167-
```
167+
```bash
168168
curl -i localhost:8080/public/numberOfUsers
169169
```
170170
It should return:
171-
```
171+
```text
172172
HTTP/1.1 200
173173
2
174174
```
175175
176176
- Call `GET /api/orders` without JWT access token:
177-
```
177+
```bash
178178
curl -i localhost:8080/api/orders
179179
```
180180
As for this endpoint a valid JWT access token is required, it should return:
181-
```
181+
```text
182182
HTTP/1.1 401
183183
```
184184
185185
- Call `POST /auth/authenticate` to get the `admin` JWT access token:
186-
```
186+
```bash
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
echo $ADMIN_ACCESS_TOKEN
191191
```
192192
193193
- Call `GET /api/orders` again, now with the `admin` JWT access token:
194-
```
194+
```bash
195195
curl -i -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" localhost:8080/api/orders
196196
```
197197
It should return an empty array or an array with orders:
198-
```
198+
```text
199199
HTTP/1.1 200
200200
[ ... ]
201201
```
202202
203203
- Call `GET /api/users/me` to get more information about the `admin`:
204-
```
204+
```bash
205205
curl -i -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" localhost:8080/api/users/me
206206
```
207207
It should return:
208-
```
208+
```text
209209
HTTP/1.1 200
210210
{
211211
"id": 1, "username": "admin", "name": "Admin", "email": "admin@mycompany.com", "role": "ADMIN",
@@ -218,11 +218,11 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
218218
- Open a terminal and make sure you are in the `springboot-react-jwt-token` root folder;
219219
220220
- Run the following script:
221-
```
221+
```bash
222222
./order-api/test-endpoints.sh
223223
```
224224
It should return something like the output below, where it shows the http code for different requests:
225-
```
225+
```text
226226
POST auth/authenticate
227227
======================
228228
admin access token
@@ -261,7 +261,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
261261
## Util Commands
262262
263263
- **Postgres**
264-
```
264+
```bash
265265
docker exec -it postgres psql -U postgres -d orderdb
266266
\dt
267267
```
@@ -275,7 +275,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
275275
- To stop `order-api` and `order-ui`, go to the terminals where they are running and press `Ctrl+C`;
276276
277277
- To stop and remove Docker Compose containers, network, and volumes, go to a terminal and, inside the `springboot-react-jwt-token` root folder, run the command below:
278-
```
278+
```bash
279279
docker compose down -v
280280
```
281281
@@ -284,7 +284,7 @@ On [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-C
284284
- In a terminal, make sure you are in the `springboot-react-jwt-token/order-ui` folder;
285285
286286
- Run the following commands:
287-
```
287+
```bash
288288
npm upgrade
289289
npm i -g npm-check-updates
290290
ncu -u

0 commit comments

Comments
(0)

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