You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,10 @@ Specifically, it fetches and displays the OpenGraph image tag from the provided
6
6
## Main components:
7
7
8
8
-**LiveViews**: The `OgCatalogWeb.OpenGraphObjectLive.Index` module handles the user interface and interactions. It allows users to input a URL and displays the corresponding OpenGraph image with real-time updates.
9
-
-**Oban**: Oban is a robust background job framework which can use PostgreSQL for storage. The `OgCatalog.Oban.FetchOpenGraphImage` module is responsible for fetching the OpenGraph image in the background. It uses Oban to manage background jobs, ensuring that the fetching process does not block the main application.
9
+
-**Oban**: Oban is a robust background job framework which can use PostgreSQL for storage. The `OgCatalog.Workers.ProcessPageUrl` module is responsible for processing page URLs and fetching the OpenGraph metadata in the background. It uses Oban to manage background jobs and delegates the actual fetching/parsing to `OgCatalog.Services.OpenGraphService`, ensuring that the fetching process does not block the main application.
10
10
-**Phoenix PubSub**: Phoenix PubSub is used to broadcast updates to the LiveView when new OpenGraph images are fetched, allowing for real-time updates without requiring a page refresh.
11
11
-**Ecto**: Ecto is used for database interactions. The `OgCatalog.OpenGraphObjects` context manages the OpenGraph objects stored in the database, allowing for efficient querying and data manipulation.
12
12
-**OpenGraph Library**: The `OpenGraph` library is utilized to fetch and parse OpenGraph metadata from the provided URLs. It simplifies the process of extracting the necessary information, such as the image tag, from the web pages.
13
-
-**Testing**: The application includes comprehensive tests for both the LiveView and the Oban worker. The tests ensure that the application behaves as expected, with proper handling of valid and invalid URLs, and that the OpenGraph images are fetched and displayed correctly.
14
13
-**Error Handling**: The application includes error handling mechanisms to manage cases where the provided URL is invalid or when the OpenGraph metadata cannot be fetched. This ensures a smooth user experience and prevents crashes.
15
14
-**Database**: PostgreSQL is used as the database for storing OpenGraph objects. The application includes migrations to set up the necessary tables and schemas.
16
15
@@ -19,7 +18,7 @@ Specifically, it fetches and displays the OpenGraph image tag from the provided
19
18
1. The user enters a URL in the LiveView interface.
20
19
2. The application validates the URL while the user types.
21
20
3. The user submits the URL.
22
-
4. The application creates a new OpenGraphObject in the database and enqueue an Oban job to process the URL and fetch the OpenGraph image.
21
+
4. The application creates a new OpenGraphObject in the database and enqueues an Oban job to process the URL and fetch the OpenGraph image.
23
22
5. The Oban worker pulls the job, fetches the page from the provided URL using the OpenGraph library. If the URL is valid and the metadata is successfully fetched, it extracts the og:image URL.
24
23
6. Once the og:image URL is fetched, the Oban worker updates the OpenGraphObject in the database and broadcasts the update to the LiveView.
25
24
7. The LiveView receives the update and displays the OpenGraph Image to the user.
@@ -33,7 +32,7 @@ Specifically, it fetches and displays the OpenGraph image tag from the provided
33
32
4. URL Shortening: Integrate a URL shortening service to handle long URLs more effectively.
34
33
5. Enhanced Error Handling: Improve error handling to provide more detailed feedback to users when fetching OpenGraph metadata fails.
35
34
36
-
## Pre-requisites
35
+
## Prerequisites
37
36
38
37
* Elixir ~> 1.19
39
38
* Erlang/OTP ~> 28.3
@@ -121,7 +120,7 @@ Once the server is running, you can access the application by navigating to [`Op
121
120
## Running the tests in a docker container
122
121
123
122
You can run the tests in a docker container to ensure a consistent environment.
124
-
The Makefile includes a `test` target that builds and runs the tests inside a Docker container.
123
+
The Makefile includes a `tests` target that builds and runs the tests inside a Docker container.
125
124
To run the tests in a Docker container, execute the following command from the project root:
0 commit comments