This project consists of a Flask backend and a React frontend to display job listings. The frontend fetches data from the backend using REST API endpoints.
Before you begin, make sure you have the following software installed on your system:
- Python (for the Flask backend) Download Python
- Node.js (for the React frontend) Download Node.js
- npm (Node Package Manager, installed automatically with Node.js)
Clone the repository to your local machine:
git clone https://github.com/arepala-uml/jobtarget-project
Move to the project directory:
cd jobtarget-project
Follow these steps to create and activate a virtual environment for the backend server:
-
cd server -
python3 -m venv venv -
- On macOS/Linux:
source venv/bin/activate - On Windows:
venv\Scripts\activate
Your terminal should now show that the virtual environment is active(indicated as (venv) at the beginning of the prompt).
- On macOS/Linux:
-
pip install -r requirements.txtThis will install all the dependencies required for backend server.
By default, the Flask backend will run on port 5000. If you want to change the port, you can specify the new port in the .env file.
FLASK_APP_PORT=5000 # Default is 5000, you can change it here
If you don’t modify the .env file, the backend will use the default port 5000.
python app.py
In flask, Default port is 5000
** Run with gunicorn **
gunicorn -w 4 --bind 0.0.0.0:5000 app:app
- -w : number of worker
docker build -t flask-example
docker run -p 5000:5000 --name flask-example flask-example
In image building, the server folder will also add into the image
http://localhost:5000
The backend will be available at above link (or the port you’ve specified in .env)
Navigate to the ui/ directory
cd jobtarget-project/
cd ui/
Install the necessary dependencies for React:
npm install
This installs all the required React libraries from package.json
Open .env file in the ui/ folder to specify the backend hostname and port:
REACT_APP_BACKEND_HOST=localhost
REACT_APP_BACKEND_PORT=5000 # Default is 5000, you can change it here to match your backend
This will allow the React app to communicate with the backend on the port you’ve specified.
Run the React frontend development server:
npm start
The frontend will be available at http://localhost:3000.