This is a simple login and logout app, made using react and flask. you can follow the steps below to set ths app on your own device and try out. It uses the JWT token authorization to validate the password while logging in.
The UI is kept simple, as the functionality and working was the main motive here
- 'frontend' - contains the react files
- 'backend' - contains the flask.py file
- Move to 'backend' folder
cd backend
- Install the python dependencies
pip install -r requirements.txt
- Create a .env file to store your 'JWT_SECRET_KEY'
- Start the flask app
python app.py
- Move to 'frontend' folder
cd frontend
- Install the node.js dependencies
npm install
- Start the React app
npm start
Now the backend is running http://127.0.0.1:5000
while the frontend is running on http://localhost:3000
, both synced to each other.
To run the flask and react app, you need to have two terminals running at the same moment, but you can save the effort with the following set of commands. Make sure you first install the necessary dependencies and then run these steps.
- Move the folder where you haev backend and frontend file located and move to the terminal
npm install -g concurrently
-
concurrently "cd backend && python app.py" "cd backend && npm start"
- The above command works on Windows, but for Linux, one additionaly step is needed
And then just
chmod +x start.sh
./start.sh
Feel free to submit issues or pull requests to improve this API. Was just learning about flask and dockerfiles.
Connect with me on: