This documentation provides an overview of the RESTfull Flask application project based on the MVC (Model-View-Controller) architecture. The project consists of two main routes: one for extracting job data using bots and another for retrieving data directly from the database. The code follows best practices to ensure better readability and maintainability.
The project is structured as follows:
-
src/
- async_app/
- app.py
- Dockerfile
- sync_app/
- bots/
- takeJobs/
- Scrapy
- takeJobs/
- controllers/
- jobs_controller.py
- models/
- jobs_models.py
- views/
- home/
- index.html
- table_ws
- index.html
- home/
- app.py
- Dockerfile
- bots/
- async_app/
-
The
app
directory contains the source code of the application. -
The
controllers
directory holds the controllers responsible for handling requests and managing the business logic. -
The
models
directory contains the data model definitions and database access operations. -
The
main.py
file serves as the entry point for the application, containing the configuration and route definitions.
= Endpoint /home
- HTTP Method: GET
- Response
- Sucess: 200 OK
- Not Found: Failed to load home page
- Endpoint:
/takejobsocket
- HTTP Method: GET
- Description: Return html table with websocket script connection to server
- Response:
- Sucess: 200 OK
- Failure: 404 Failed to load table page
- Endpoint:
/jobs/<search>
- HTTP Method: GET
- Description: Extracts job data using bots based on the provided search parameter
- Response:
- Success: 200 OK
- Failure: 404 Jobs not found
- Endpoint:
- Websocket
- Description: Create to show the user how fast framework scrapy can take information from web
- Endpoint:
/jobs/<search>/<page>/<limit>
- HTTP Method: GET
- Description: Retrieves job data from the database based on the provided search, page, and limit parameters
- Response:
- Success: 200 OK with the job data in JSON format
- Not Found: 404 Not Found if the job data is not available
To run the application, follow these steps:
- Ensure that Python and the project dependencies are installed.
- Execute the following commands in the terminal:
- pip install -r requirements.txt
- python main.py
- Access the application at
http://localhost:3001
.
This documentation provides a brief overview of the RESTful Flask application project, focusing on the available endpoints and their functionalities. The project follows the MVC architecture, providing separate components for controllers and models to handle requests and database operations, respectively.