- Windows 10
- Python 3.12.4
- Node.js v20.11.1
- npm v10.5.0
-
Clone the repository
git clone https://github.com/helloworld0606/interviewPython.git
-
Set up the backend server (cmd)
cd C:\interviewPython\backend python -m venv venv .\venv\Scripts\activate pip install -r requirements.txt
Install Rust (if not already installed) Rust is needed to compile
bcrypt
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Run the backend server
python app.py
-
Run the frontend server (terminal)
cd C:\interviewPython\frontend npm install npm audit # find security vulnerabilities npm audit fix # fix any security vulnerabilities npm run serve
-
The app will run at http://localhost:8080/
"make sure backend is running"
Get account
curl -X GET http://localhost:3000/users
Add account
curl -X POST "http://localhost:3000/users" -H "Content-Type: application/json" -d "{\"id\": 2, \"name\": \"James\", \"account\": \"[email protected]\", \"password\": \"DEF789\"}"
Login account
curl -X POST "http://localhost:3000/users/login" -H "Content-Type: application/json" -d "{\"account\":\"[email protected]\",\"password\":\"ABC123456\"}"
Two Factor Auth
- When login is successful, a QR code window will pop up.
- Scan the QR code using the Authenticator app on your iPhone.
- Replace XXXXXX (6 digits) with the one-time code from MyApp.
curl -X POST "http://localhost:3000/2fa/verify-otp" -H "Content-Type: application/json" -d "{\"userId\":1,\"otp\”:\”XXXXXX\”}”
Account: [email protected]
Password: ABC123456
- The login info will be saved in session storage
- To try a new login, open the inspect window —> go to Application —> SessionStorage —> clear all login records —> refresh the website