Skip to content

Commit fb80c8e

Browse files
committed
update 01-headers
1 parent cbdcc86 commit fb80c8e

73 files changed

Lines changed: 7791 additions & 420 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

06-rest-api/02-auth/01-headers/README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22

33
In this example we will login an user using a JWT token in Http Headers and load client and order collections.
44

5-
# Steps to build it
5+
## Install dependencies
66

7-
- `npm install` to install packages:
7+
`npm install` to install packages:
88

99
```bash
10+
cd back
1011
npm install
1112
```
1213

13-
- Start `back` app:
14+
```bash
15+
cd front
16+
npm install
17+
```
18+
19+
## Start apps
20+
21+
Start `back` app:
1422

1523
```bash
1624
cd ./back
@@ -19,25 +27,25 @@ npm start
1927

2028
> NOTE: We added `.env` file only for demo purpose. We should ignore this one and add a `.env.example` as example.
2129
22-
- Start `front` app:
30+
Start `front` app:
2331

2432
```bash
2533
cd ./front
2634
npm start
2735
```
2836

29-
- We don't need CORS because we are using `webpack's proxy`, so it looks like same domain:
37+
We don't need CORS because we are using a `proxy`, so it looks like same domain:
3038

31-
_./front/config/webpack/dev.js_
39+
_./front/vite.config.ts_
3240

3341
```javascript
3442
...
35-
devServer: {
36-
...
43+
server: {
3744
proxy: {
38-
'/api': 'http://localhost:8081',
45+
'/api': 'http://localhost:3000',
3946
},
4047
},
48+
...
4149
```
4250

4351
## Demo
@@ -68,8 +76,8 @@ _./front/config/webpack/dev.js_
6876

6977
Backend:
7078

71-
- `back/src/core/servers/express.server.ts`
72-
- `back/src/app.ts`
79+
- `back/src/core/servers/rest-api.server.ts`
80+
- `back/src/index.ts`
7381
- `back/src/pods/security/security.api.ts`
7482
- Check user credentials.
7583
- Create `jwt` by user credentials.
@@ -82,15 +90,15 @@ Frontend:
8290
- `front/src/pods/login/login.container.tsx`
8391
- `front/src/pods/login/login.hooks.ts`
8492
- `front/src/pods/login/api/login.api.ts`
85-
- `front/src/core/api/api/api.helpers.ts`
86-
- `front/src/common-app/auth/auth.context.ts`
87-
- `front/src/common-app/app-abr/app-bar.component.tsx`
93+
- `front/src/core/api/api.helpers.ts`
94+
- `front/src/core/auth/auth.context.ts`
95+
- `front/src/core/app-bar/app-bar.component.tsx`
8896

8997
## Load list flow
9098

9199
Backend:
92100

93-
- `back/src/app.ts`
101+
- `back/src/index.ts`
94102
- `back/src/pods/security/security.middlewares.ts`
95103
- `back/src/pods/client/client.api.ts`
96104
- `back/src/pods/order/order.api.ts`
@@ -104,13 +112,13 @@ Frontend:
104112

105113
Backend:
106114

107-
- `back/src/app.ts`: We are not using `jwtMiddleware` on root security api.
115+
- `back/src/index.ts`: We are not using `jwtMiddleware` on root security api.
108116
- `back/src/pods/security/security.api.ts`
109117

110118
Frontend:
111119

112-
- `front/src/common-app/app-bar/app-bar.component.tsx`
113-
- `front/src/common-app/app-bar/app-bar.api.tsx`: clear header.
120+
- `front/src/core/app-bar/app-bar.component.tsx`
121+
- `front/src/core/app-bar/app-bar.api.tsx`: clear header.
114122

115123
# About Basefactor + Lemoncode
116124

06-rest-api/02-auth/01-headers/back/.babelrc

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
NODE_ENV=development
2-
PORT=8081
2+
PORT=3000
33
TOKEN_AUTH_SECRET=MY_TOKEN_AUTH_SECRET
44
ACCESS_TOKEN_EXPIRES_IN=1d

06-rest-api/02-auth/01-headers/back/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)