Git Product home page Git Product logo

express-jwt-react's Introduction

express-jwt-react

This project was aimed at understanding how to create a secure React JS SPA web app that allows for dynamaic routing based on current authentication/authorization status verified by an Express JS API using JWT tokens.

Here is a screen shot of the React JS SPA web app login screen:

Dependencies

Install all of the dependencies enter this in the terminal within the root of this projects directory:

npm install

To install all of the dependencies for the front end, enter this in the terminal within the root of this projects directory:

cd front-end && npm install

The next step is to setup the MySQL database. To do this open up the mysql CLI on your system.

mysql -u <MySQL username> -p

Next enter in this command in the MySQL CLI:

source ./MySQL/setup.sql

Next it is imperative to create the dotenv variables for the back end in the root of this projects directory:

touch .env

This will create a file to store the projects environment variables open the file and enter:

TOKEN_SECRET=<a secret key for signing the JWT>
DB_HOST=localhost
DB_USER=<database username>
DB_PASS=<database usernames password>
DB_DB=express_jwt_react_dev_db

Executing

There are two parts to this application that need to be started seperately when in "developer mode"; the front and back end. To start the back end side in the root of this projects directory enter:

npm start

Next to start the front end open another terminal and from the root of the project directory enter:

cd front-end && npm start

This will start the ReactJS development server which should open the locally hosted application in your default web browser at: localhost:3000

Happy Coding.

express-jwt-react's People

Contributors

mattboan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.