https://github.com/linuxuser255/jwt_reactapp
A basic web app that demonstrates the creation and use of Java Web Tokens written in Node.JS and React
https://github.com/linuxuser255/jwt_reactapp
Last synced: 10 months ago
JSON representation
A basic web app that demonstrates the creation and use of Java Web Tokens written in Node.JS and React
- Host: GitHub
- URL: https://github.com/linuxuser255/jwt_reactapp
- Owner: LinuxUser255
- Created: 2023-06-28T20:22:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-28T21:13:17.000Z (over 2 years ago)
- Last Synced: 2025-02-28T05:56:23.909Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Login page: NodeJS React & JWTs
### Built With
* https://react.dev
* https://nodejs.org/en
## Overview
* Set up authentication so that only a request with a JWT can access the dashboard
* After a user signs up they log in and are given a signed JWT
* Only registered users should be able to obtain a JWT
## How the app works
When logging in, the app looks for the username and password.
If both the username and password exist, then it will create a new signed JWT. Otherwise, an error is returned.
Upon successful creation of the JWT, the user will be notified.
**The main endpoints, and correct URL with correct paths are:**
```
http://localhost:3000/api/v1/dashboard
http://localhost:3000/api/v1/login
```
## Getting Started
1. Check that the package versions in **package.json** are the most recent
2. Edit the package.json file accordingly before running the npm install command
3. Once all that is done, run the following commands
* Install the packages and Express for API development
```sh
npm install --save express
```
* Install nodemon it's a development package. It auto runs the server.
```shell
npm install --save-dev nodemon
```
* Edit `package.json` to make running the server easier. Add this to the `package.json` file
```shell
"start": "nodemon.js"
```
* Install a parser to parse incoming request bodies
```shell
npm install --save body-parser
```
## Usage
Run the commands listed above in the console of your IDE, (I used Jet Brains WebStorm). Then open a browser and navigate to http://localhost:3000
_For more information, please refer to the [WebStorm Documentation](https://www.jetbrains.com/help/webstorm/meet-webstorm.html)_