Skip to content

Commit af4d255

Browse files
committed
first commit
1 parent 2ead6d5 commit af4d255

18 files changed

+14904
-128
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PORT=8081

README.md

+38-53
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,53 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2-
3-
## Available Scripts
4-
5-
In the project directory, you can run:
6-
7-
### `yarn start`
8-
9-
Runs the app in the development mode.<br />
10-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11-
12-
The page will reload if you make edits.<br />
13-
You will also see any lint errors in the console.
14-
15-
### `yarn test`
16-
17-
Launches the test runner in the interactive watch mode.<br />
18-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19-
20-
### `yarn build`
1+
## React Hooks: JWT Authentication (without Redux) example
212

22-
Builds the app for production to the `build` folder.<br />
23-
It correctly bundles React in production mode and optimizes the build for the best performance.
3+
For more detail, please visit:
244

25-
The build is minified and the filenames include the hashes.<br />
26-
Your app is ready to be deployed!
5+
> [React Hooks: JWT Authentication & Authorization example](https://bezkoder.com/react-hooks-jwt-auth/)
276
28-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29-
30-
### `yarn eject`
31-
32-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33-
34-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35-
36-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37-
38-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39-
40-
## Learn More
41-
42-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43-
44-
To learn React, check out the [React documentation](https://reactjs.org/).
7+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
458

46-
### Code Splitting
9+
### Set port
10+
.env
11+
```
12+
PORT=8081
13+
```
4714

48-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
15+
## Note:
16+
Open `src/services/auth-header.js` and modify `return` statement for appropriate back-end (found in the tutorial).
4917

50-
### Analyzing the Bundle Size
18+
```js
19+
export default function authHeader() {
20+
const user = JSON.parse(localStorage.getItem('user'));
5121

52-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
22+
if (user && user.accessToken) {
23+
// return { Authorization: 'Bearer ' + user.accessToken }; // for Spring Boot back-end
24+
return { 'x-access-token': user.accessToken }; // for Node.js Express back-end
25+
} else {
26+
return {};
27+
}
28+
}
29+
```
5330

54-
### Making a Progressive Web App
31+
## Project setup
5532

56-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
33+
In the project directory, you can run:
5734

58-
### Advanced Configuration
35+
```
36+
npm install
37+
# or
38+
yarn install
39+
```
5940

60-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
41+
or
6142

62-
### Deployment
43+
### Compiles and hot-reloads for development
6344

64-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
45+
```
46+
npm start
47+
# or
48+
yarn start
49+
```
6550

66-
### `yarn build` fails to minify
51+
Open [http://localhost:8081](http://localhost:8081) to view it in the browser.
6752

68-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
53+
The page will reload if you make edits.

0 commit comments

Comments
 (0)