about summary refs log tree commit diff
path: root/crawler
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-30 12:59:46 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-30 12:59:46 +0100
commit620d82cc3910d21940e9cc737900440be3b0ced4 (patch)
tree82f8b4b9e93deed5f72a61c5784d6fff5c5bc971 /crawler
parentFrontend: Add props to the OSSE Component (diff)
downloadOSSE-620d82cc3910d21940e9cc737900440be3b0ced4.tar.gz
OSSE-620d82cc3910d21940e9cc737900440be3b0ced4.tar.bz2
OSSE-620d82cc3910d21940e9cc737900440be3b0ced4.zip
Misc: Add local lib crate to share common structs
Diffstat (limited to 'crawler')
-rw-r--r--crawler/Cargo.toml1
-rw-r--r--crawler/src/main.rs8
2 files changed, 2 insertions, 7 deletions
diff --git a/crawler/Cargo.toml b/crawler/Cargo.toml
index c58b458..6badd7a 100644
--- a/crawler/Cargo.toml
+++ b/crawler/Cargo.toml
@@ -14,6 +14,7 @@ tokio = { version = "0.2.22", features = ["full"] }
 async-channel = "1.7.1"
 url = "2.3.1"
 rand = "0.7.3"
+lib = { path = "../lib" }
 
 [[bin]]
 name = "crawler"
diff --git a/crawler/src/main.rs b/crawler/src/main.rs
index a831655..a3dc06b 100644
--- a/crawler/src/main.rs
+++ b/crawler/src/main.rs
@@ -1,8 +1,8 @@
 use itertools::Itertools;
 use rand::seq::IteratorRandom;
 use reqwest::{Client, Response, StatusCode};
-use serde::Serialize;
 use url::Url;
+use lib::lib::*;
 
 #[tokio::main]
 async fn main() {
@@ -137,12 +137,6 @@ async fn push_crawl_entry_to_indexer(
 ) -> Result<Response, String> {
     dbg!("Pushin to indexer");
 
-    #[derive(Serialize, Debug)]
-    struct CrawledResource {
-        url: String,
-        content: String,
-    }
-
     let request_body = CrawledResource { url, content };
 
     match http_client