From 07717bf6e0bb9c5dbe8773489ab54cbd8d6099b7 Mon Sep 17 00:00:00 2001
From: christhomas1190 <111439861+christhomas1190@users.noreply.github.com>
Date: Fri, 9 May 2025 11:02:02 -0400
Subject: [PATCH 01/29] trudging through the mud to have something presentable
---
frontend/package-lock.json | 54 +++++++++++++++++++++++++
frontend/package.json | 1 +
frontend/src/Components/App.js | 36 +++++++----------
frontend/src/Components/NewsArticle.css | 44 ++++++++++++++++++++
frontend/src/Components/NewsArticle.js | 32 +++++++++++++++
frontend/src/Components/NewsCard.js | 10 ++---
frontend/src/Components/NewsGrid.js | 21 +++++-----
7 files changed, 160 insertions(+), 38 deletions(-)
create mode 100644 frontend/src/Components/NewsArticle.css
create mode 100644 frontend/src/Components/NewsArticle.js
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 18eb0d0..491647b 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -14,6 +14,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
+ "react-router-dom": "^7.6.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}
@@ -13916,6 +13917,53 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-router": {
+ "version": "7.6.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.6.0.tgz",
+ "integrity": "sha512-GGufuHIVCJDbnIAXP3P9Sxzq3UUsddG3rrI3ut1q6m0FI6vxVBF3JoPQ38+W/blslLH4a5Yutp8drkEpXoddGQ==",
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "^1.0.1",
+ "set-cookie-parser": "^2.6.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "7.6.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.6.0.tgz",
+ "integrity": "sha512-DYgm6RDEuKdopSyGOWZGtDfSm7Aofb8CCzgkliTjtu/eDuB0gcsv6qdFhhi8HdtmA+KHkt5MfZ5K2PdzjugYsA==",
+ "license": "MIT",
+ "dependencies": {
+ "react-router": "7.6.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ }
+ },
+ "node_modules/react-router/node_modules/cookie": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
+ "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",
@@ -14822,6 +14870,12 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/set-cookie-parser": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
+ "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
+ "license": "MIT"
+ },
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index bfb0044..c7f70f9 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -9,6 +9,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
+ "react-router-dom": "^7.6.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
diff --git a/frontend/src/Components/App.js b/frontend/src/Components/App.js
index e05f747..7559ead 100644
--- a/frontend/src/Components/App.js
+++ b/frontend/src/Components/App.js
@@ -1,29 +1,21 @@
-import React, { useState } from 'react';
-import './App.css';
+import React from 'react';
+import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import NewsGrid from './NewsGrid';
+import NewsArticle from './NewsArticle';
+import './App.css';
function App() {
- const [selectedArticle, setSelectedArticle] = useState(null);
-
return (
-
-
CrossKey Communication
- {selectedArticle ? (
-
-
-
-
- ) : (
-
- )}
-
+
+
+
CrossKey Communication
+
+ } />
+ } />
+
+
+
);
}
-export default App;
+export default App;
\ No newline at end of file
diff --git a/frontend/src/Components/NewsArticle.css b/frontend/src/Components/NewsArticle.css
new file mode 100644
index 0000000..69ebfdb
--- /dev/null
+++ b/frontend/src/Components/NewsArticle.css
@@ -0,0 +1,44 @@
+.news-article {
+ max-width: 800px;
+ margin: 2rem auto;
+ padding: 1.5rem;
+ background-color: white;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
+ font-family: Arial, sans-serif;
+ line-height: 1.6;
+}
+
+.news-article img {
+ width: 100%;
+ height: auto;
+ border-radius: 8px;
+ margin-bottom: 1.5rem;
+ object-fit: cover;
+}
+
+.news-article h1 {
+ font-size: 2rem;
+ margin-bottom: 0.75rem;
+ color: #222;
+}
+
+.news-article-author {
+ font-style: italic;
+ font-size: 0.95rem;
+ color: gray;
+ margin-bottom: 1.2rem;
+}
+
+.news-article-description {
+ font-size: 1.2rem;
+ color: #444;
+ margin-bottom: 1rem;
+}
+
+.news-article-source {
+ font-size: 0.9rem;
+ color: #777;
+ margin-top: 2rem;
+ text-align: right;
+}
diff --git a/frontend/src/Components/NewsArticle.js b/frontend/src/Components/NewsArticle.js
new file mode 100644
index 0000000..245d66c
--- /dev/null
+++ b/frontend/src/Components/NewsArticle.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import { useLocation, useNavigate } from 'react-router-dom';
+import './NewsArticle.css';
+
+function NewsArticle() {
+ const location = useLocation();
+ const navigate = useNavigate();
+ const article = location.state?.article;
+
+ if (!article) {
+ return No article data.
;
+ }
+
+ return (
+
+
+ {article.urlToImage && (
+

+ )}
+
{article.title}
+
+ {article.author ? `By ${article.author}` : 'Unknown Author'} •{' '}
+ {new Date(article.publishedAt).toLocaleDateString()}
+
+
{article.description}
+
{article.content}
+
Source: {article.name}
+
+ );
+}
+
+export default NewsArticle;
\ No newline at end of file
diff --git a/frontend/src/Components/NewsCard.js b/frontend/src/Components/NewsCard.js
index 9f1f5ca..39f90a6 100644
--- a/frontend/src/Components/NewsCard.js
+++ b/frontend/src/Components/NewsCard.js
@@ -3,13 +3,9 @@ import './NewsCard.css';
function NewsCard({ article, onClick }) {
return (
- onClick(article)}>
+
-

+
{article.title}
{article.description}
@@ -19,4 +15,4 @@ function NewsCard({ article, onClick }) {
);
}
-export default NewsCard;
\ No newline at end of file
+export default NewsCard;
diff --git a/frontend/src/Components/NewsGrid.js b/frontend/src/Components/NewsGrid.js
index eaea1a2..02bb71a 100644
--- a/frontend/src/Components/NewsGrid.js
+++ b/frontend/src/Components/NewsGrid.js
@@ -1,24 +1,27 @@
-import React, { useState, useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import NewsCard from './NewsCard';
import './NewsGrid.css';
+import { useNavigate } from 'react-router-dom';
-function NewsGrid({ onArticleClick }) {
+function NewsGrid() {
const [articles, setArticles] = useState([]);
+ const navigate = useNavigate();
useEffect(() => {
fetch('http://localhost:8081/articles/fetch')
.then(response => response.json())
- .then(data => {
- console.log('Fetched articles:', data);
- setArticles(data);
- })
- .catch(error => console.error('Error fetching articles:', error));
+ .then(data => setArticles(data))
+ .catch(err => console.error('Fetch error:', err));
}, []);
+ const handleClick = (article, index) => {
+ navigate(`/article/${index}`, { state: { article } });
+ };
+
return (
- {Array.isArray(articles) && articles.map((article, index) => (
-
+ {articles.map((article, index) => (
+ handleClick(article, index)} />
))}
);
From 16b231a6a52db6940d9d12bdcc7e5c513060903e Mon Sep 17 00:00:00 2001
From: christhomas1190 <111439861+christhomas1190@users.noreply.github.com>
Date: Fri, 9 May 2025 13:42:20 -0400
Subject: [PATCH 02/29] checkpoint?
---
.idea/BrandonGrahamDay.iml | 1 +
.../rocks/zipcode/CKC/Articles/Articles.java | 3 +
.../CKC/Articles/ArticlesController.java | 2 +-
.../zipcode/CKC/Articles/ArticlesService.java | 78 +++++++++++++++----
4 files changed, 68 insertions(+), 16 deletions(-)
diff --git a/.idea/BrandonGrahamDay.iml b/.idea/BrandonGrahamDay.iml
index 5d40fe1..ef5d98d 100644
--- a/.idea/BrandonGrahamDay.iml
+++ b/.idea/BrandonGrahamDay.iml
@@ -71,5 +71,6 @@
+
\ No newline at end of file
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
index 960ead5..ffde3d6 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
@@ -73,4 +73,7 @@ public Articles(Long id, String title, String author, String thumbnail, String a
public void setArticleDescription(String description) {
}
+
+ public void setSource(ArticlesSource source) {
+ }
}
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
index 8ff902c..449b4e1 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
@@ -20,7 +20,7 @@ public class ArticlesController {
@CrossOrigin(origins = "http://localhost:3000") // Allows frontend access
@GetMapping("/fetch")
- public List
fetchArticles() {
+ public List fetchArticles() {
return articlesService.fetchNews();
}
}
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
index 4a8202d..bb91ba9 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
@@ -21,8 +21,9 @@ public ArticlesService(ArticlesRepository articlesRepository) {
this.articlesRepository = articlesRepository;
}
- public List fetchNews() {
- List dtoList = new ArrayList<>();
+ public List fetchNews() {
+ List savedArticles = new ArrayList<>();
+
try {
String url = "https://newsapi.org/v2/top-headlines?country=us&apiKey=e31ee66a0d864e2e9a447942e8af0b2c";
RestTemplate restTemplate = new RestTemplate();
@@ -33,31 +34,78 @@ public List fetchNews() {
JsonNode articlesNode = root.path("articles");
for (JsonNode node : articlesNode) {
- ArticlesDTO dto = new ArticlesDTO();
- dto.setTitle(node.path("title").asText(null));
- dto.setAuthor(node.path("author").asText(null));
- dto.setDescription(node.path("description").asText(null));
- dto.setContent(node.path("content").asText(null));
- dto.setUrlToImage(node.path("urlToImage").asText(null));
- dto.setPublishedAt(node.path("publishedAt").asText(null));
+ Articles article = new Articles();
+ article.setTitle(node.path("title").asText(null));
+ article.setAuthor(node.path("author").asText(null));
+ article.setThumbnail(node.path("urlToImage").asText(null));
+ article.setArticleDescription(node.path("description").asText(null));
+ article.setArticleBody(node.path("content").asText(null));
+ // Handle embedded source
+ ArticlesSource source = new ArticlesSource();
JsonNode sourceNode = node.path("source");
- if (!sourceNode.isMissingNode()) {
- dto.setId(sourceNode.path("id").asText(null));
- dto.setName(sourceNode.path("name").asText(null));
- }
+ source.setId(sourceNode.path("id").asText(null));
+ source.setName(sourceNode.path("name").asText(null));
+ article.setSource(source);
- dtoList.add(dto);
+ // ✅ Save to DB
+ Articles saved = articlesRepository.save(article);
+ savedArticles.add(saved);
}
+
} catch (Exception e) {
e.printStackTrace();
}
- return dtoList;
+
+ return savedArticles;
}
}
+
+
+
+
+
+
+ // public List fetchNews() {
+// List dtoList = new ArrayList<>();
+// try {
+// String url = "https://newsapi.org/v2/top-headlines?country=us&apiKey=e31ee66a0d864e2e9a447942e8af0b2c";
+// RestTemplate restTemplate = new RestTemplate();
+// ResponseEntity response = restTemplate.getForEntity(url, String.class);
+//
+// ObjectMapper mapper = new ObjectMapper();
+// JsonNode root = mapper.readTree(response.getBody());
+// JsonNode articlesNode = root.path("articles");
+//
+// for (JsonNode node : articlesNode) {
+// ArticlesDTO dto = new ArticlesDTO();
+// dto.setTitle(node.path("title").asText(null));
+// dto.setAuthor(node.path("author").asText(null));
+// dto.setDescription(node.path("description").asText(null));
+// dto.setContent(node.path("content").asText(null));
+// dto.setUrlToImage(node.path("urlToImage").asText(null));
+// dto.setPublishedAt(node.path("publishedAt").asText(null));
+//
+// JsonNode sourceNode = node.path("source");
+// if (!sourceNode.isMissingNode()) {
+// dto.setId(sourceNode.path("id").asText(null));
+// dto.setName(sourceNode.path("name").asText(null));
+// }
+//
+// dtoList.add(dto);
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// return dtoList;
+// }
+//}
+
+
+
//@Service
//public class ArticlesService {
//
From 4743c8d46d8a712bfc5bbae8220788a7b3b7eb3f Mon Sep 17 00:00:00 2001
From: christhomas1190 <111439861+christhomas1190@users.noreply.github.com>
Date: Fri, 9 May 2025 13:48:45 -0400
Subject: [PATCH 03/29] checkpoint
---
.../main/java/rocks/zipcode/CKC/Articles/ArticlesService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
index bb91ba9..c9b575a 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
@@ -48,7 +48,7 @@ public List fetchNews() {
source.setName(sourceNode.path("name").asText(null));
article.setSource(source);
- // ✅ Save to DB
+ //Save to DB
Articles saved = articlesRepository.save(article);
savedArticles.add(saved);
}
From 4fcb6dbffcaa8df309d6b8bb6fc8058a192ff12d Mon Sep 17 00:00:00 2001
From: christhomas1190 <111439861+christhomas1190@users.noreply.github.com>
Date: Fri, 9 May 2025 15:04:40 -0400
Subject: [PATCH 04/29] pictures not working
---
.idea/BrandonGrahamDay.iml | 1 +
CKC/pom.xml | 8 +-
.../rocks/zipcode/CKC/Articles/Articles.java | 86 +++++++++---------
.../CKC/Articles/ArticlesController.java | 14 +--
.../zipcode/CKC/Articles/ArticlesDTO.java | 2 +-
.../zipcode/CKC/Articles/ArticlesService.java | 49 +---------
.../rocks/zipcode/CKC/Articles/Articles.class | Bin 2392 -> 0 bytes
.../zipcode/CKC/Articles/ArticlesConfig.class | Bin 641 -> 0 bytes
.../CKC/Articles/ArticlesController.class | Bin 1600 -> 0 bytes
.../CKC/Articles/ArticlesDTO$Source.class | Bin 602 -> 0 bytes
.../zipcode/CKC/Articles/ArticlesDTO.class | Bin 2381 -> 0 bytes
.../CKC/Articles/ArticlesRepository.class | Bin 350 -> 0 bytes
.../zipcode/CKC/Articles/ArticlesSource.class | Bin 945 -> 0 bytes
.../rocks/zipcode/CKC/Category/Category.class | Bin 1203 -> 0 bytes
.../CKC/Category/CategoryController.class | Bin 3501 -> 0 bytes
.../CKC/Category/CategoryRepository.class | Bin 436 -> 0 bytes
.../CKC/Category/CategoryService.class | Bin 2212 -> 0 bytes
.../rocks/zipcode/CKC/Comments/Comments.class | Bin 2145 -> 0 bytes
.../zipcode/CKC/Comments/CommentsConfig.class | Bin 641 -> 0 bytes
.../CKC/Comments/CommentsController.class | Bin 5593 -> 0 bytes
.../CKC/Comments/CommentsRepository.class | Bin 350 -> 0 bytes
.../zipcode/CKC/User/UserRepository.class | Bin 707 -> 0 bytes
.../rocks/zipcode/CKC/User/Users.class | Bin 2951 -> 0 bytes
23 files changed, 61 insertions(+), 99 deletions(-)
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/Articles.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesConfig.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesController.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesDTO$Source.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesDTO.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesRepository.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesSource.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/Category.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryController.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryRepository.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryService.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Comments/Comments.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Comments/CommentsConfig.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Comments/CommentsController.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/Comments/CommentsRepository.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/User/UserRepository.class
delete mode 100644 out/production/BrandonGrahamDay/rocks/zipcode/CKC/User/Users.class
diff --git a/.idea/BrandonGrahamDay.iml b/.idea/BrandonGrahamDay.iml
index ef5d98d..e94984e 100644
--- a/.idea/BrandonGrahamDay.iml
+++ b/.idea/BrandonGrahamDay.iml
@@ -72,5 +72,6 @@
+
\ No newline at end of file
diff --git a/CKC/pom.xml b/CKC/pom.xml
index 4501ccf..e9257ec 100644
--- a/CKC/pom.xml
+++ b/CKC/pom.xml
@@ -47,13 +47,17 @@
com.fasterxml.jackson.core
jackson-databind
- 2.15.3
+ 2.17.0
com.fasterxml.jackson.core
jackson-core
2.15.3
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
@@ -123,4 +127,4 @@
-
+
\ No newline at end of file
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
index ffde3d6..f177b3c 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/Articles.java
@@ -1,3 +1,4 @@
+
package rocks.zipcode.CKC.Articles;
import jakarta.persistence.*;
@@ -21,59 +22,58 @@ public class Articles {
String articleBody;
@Embedded
ArticlesSource source;
+public Long getId() {
+ return id;
+}
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
- public String getTitle() {
- return title;
- }
+public void setId(Long id) {
+ this.id = id;
+}
+public String getTitle() {
+ return title;
+}
- public void setTitle(String title) {
- this.title = title;
- }
+public void setTitle(String title) {
+ this.title = title;
+}
- public String getAuthor() {
- return author;
- }
+public String getAuthor() {
+ return author;
+}
- public void setAuthor(String author) {
- this.author = author;
- }
+public void setAuthor(String author) {
+ this.author = author;
+}
- public String getThumbnail() {
- return thumbnail;
- }
+public String getThumbnail() {
+ return thumbnail;
+}
- public void setThumbnail(String thumbnail) {
- this.thumbnail = thumbnail;
- }
+public void setThumbnail(String thumbnail) {
+ this.thumbnail = thumbnail;
+}
- public String getArticleBody() {
- return articleBody;
- }
+public String getArticleBody() {
+ return articleBody;
+}
- public void setArticleBody(String articleBody) {
- this.articleBody = articleBody;
- }
+public void setArticleBody(String articleBody) {
+ this.articleBody = articleBody;
+}
- public Articles(){}
+public Articles(){}
- public Articles(Long id, String title, String author, String thumbnail, String articleBody) {
- this.id = id;
- this.title = title;
- this.author = author;
- this.thumbnail = thumbnail;
- this.articleBody = articleBody;
- }
+public Articles(Long id, String title, String author, String thumbnail, String articleBody) {
+ this.id = id;
+ this.title = title;
+ this.author = author;
+ this.thumbnail = thumbnail;
+ this.articleBody = articleBody;
+}
- public void setArticleDescription(String description) {
- }
+public void setArticleDescription(String description) {
+}
- public void setSource(ArticlesSource source) {
- }
+public void setSource(ArticlesSource source) {
}
+}
\ No newline at end of file
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
index 449b4e1..c597d59 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesController.java
@@ -2,10 +2,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/articles")
+@CrossOrigin(origins = "http://localhost:3000")
public class ArticlesController {
private final ArticlesRepository articlesRepository;
@@ -15,12 +17,12 @@ public class ArticlesController {
public ArticlesController(ArticlesRepository articlesRepository, ArticlesService articlesService){ this.articlesRepository = articlesRepository;
this.articlesService = articlesService; }
- @GetMapping
- public Iterable getAllArticles(){ return articlesRepository.findAll(); }
-
- @CrossOrigin(origins = "http://localhost:3000") // Allows frontend access
@GetMapping("/fetch")
- public List fetchArticles() {
+ public List getNews() {
return articlesService.fetchNews();
}
-}
+
+ @GetMapping
+ public Iterable getAllArticles(){ return articlesRepository.findAll(); }
+
+}
\ No newline at end of file
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesDTO.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesDTO.java
index d6cca6a..ade569f 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesDTO.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesDTO.java
@@ -85,4 +85,4 @@ public String getContent() {
public void setContent(String content) {
this.content = content;
}
-}
+}
\ No newline at end of file
diff --git a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
index c9b575a..b2378e6 100644
--- a/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
+++ b/CKC/src/main/java/rocks/zipcode/CKC/Articles/ArticlesService.java
@@ -1,16 +1,13 @@
package rocks.zipcode.CKC.Articles;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
-import rocks.zipcode.CKC.Articles.ArticlesDTO;
-import java.util.List;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.List;
@Service
public class ArticlesService {
@@ -48,7 +45,7 @@ public List fetchNews() {
source.setName(sourceNode.path("name").asText(null));
article.setSource(source);
- //Save to DB
+ // Save to DB
Articles saved = articlesRepository.save(article);
savedArticles.add(saved);
}
@@ -64,48 +61,6 @@ public List fetchNews() {
-
-
-
-
-
- // public List fetchNews() {
-// List dtoList = new ArrayList<>();
-// try {
-// String url = "https://newsapi.org/v2/top-headlines?country=us&apiKey=e31ee66a0d864e2e9a447942e8af0b2c";
-// RestTemplate restTemplate = new RestTemplate();
-// ResponseEntity response = restTemplate.getForEntity(url, String.class);
-//
-// ObjectMapper mapper = new ObjectMapper();
-// JsonNode root = mapper.readTree(response.getBody());
-// JsonNode articlesNode = root.path("articles");
-//
-// for (JsonNode node : articlesNode) {
-// ArticlesDTO dto = new ArticlesDTO();
-// dto.setTitle(node.path("title").asText(null));
-// dto.setAuthor(node.path("author").asText(null));
-// dto.setDescription(node.path("description").asText(null));
-// dto.setContent(node.path("content").asText(null));
-// dto.setUrlToImage(node.path("urlToImage").asText(null));
-// dto.setPublishedAt(node.path("publishedAt").asText(null));
-//
-// JsonNode sourceNode = node.path("source");
-// if (!sourceNode.isMissingNode()) {
-// dto.setId(sourceNode.path("id").asText(null));
-// dto.setName(sourceNode.path("name").asText(null));
-// }
-//
-// dtoList.add(dto);
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// return dtoList;
-// }
-//}
-
-
-
//@Service
//public class ArticlesService {
//
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/Articles.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/Articles.class
deleted file mode 100644
index 17763d73d7f69ab3983f36e3be2327177145cf9e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2392
zcmbW2|4ti65XWbYjWIqwcjDNp%hEZEZm_gy8;V`G
zb1_W|bTdz%ShPrGa11fNKY1tH0o*=Ujtc66CRW#u1(kp3JAvxSW96%puH11PH?RZc
zI=-Mq0KSKFyLK);U-^M_+Ol@o*%ov^Rdpa8>Dhto9NXQ#gxQoI@c#7TKTaTC>*8FW
zINWQ#ZXLFM6m%ywM#Js)dk%bO9lM7t7B6e?_7I6LMZ1Mk$n^S#%eM!
zx6Bl{!tBmpK?|Fh%N|)Q#9f32?4$rEmlY|%{Bmuv^I=^q_B7m<_|&l5QExsP7yJ~D
zr$;Y#g)sjAlQ8wdFx-`vD0bp~Gi_?Tuecsjw`_6^$8~iRLl|5j^|t{xI&->=&`#Or
zu0Ac}0a(B@mB$}mClYiEt6MZdxADD${il+a=q^>TT=wZRNb&lFc13(c#XTtS-i#{l
zLxERkRIviZgEYnGP~b%xJ+TVK8dXCD!>&UzgYQGy!2eC`YWNC#bJgET{E9^eBGNbG
zdp*M1G6wXRzQ9h+LDJ4O+0P=JUh-p57U*fdVTu*{LO9iQ?gIrI7yZ}gj42bDz{2o$yq(}as
z`JpTBY@(N`AdB>Ec=#7I;Uw%TRUFn0TYWg7e05_$#cDY_pi;G*8&C{!Nssw1WvPK7
z-lGyVF=+e1IY487r{mR)L4xRBwg=)vdlsOU+b&@0YvRh8$8N@J`L_CWG<{9#B@g#Ux=oY_jv}NEJ=1-JX?u=os
zSgI$HV%V`J=!E=L^#k)DdG)f&E7qx?E5qp}gQVA8U?|Oit{UA`ErxiN1Q~KQrRCM2
z*O2y3G`f^oshL1@>%uA@kCSots6vMQ+RPQo3@I^gm0`D7nuSWFt($>%swe9zR8+sB
zwQ<5JqpAEs&Da(X`&Q{z(~6#aHnzh9qn&(lTuh<-TnbHEnOifkfxJ-uUxmrwMiV&n
z<7YUYRdU1{*r=B>w&B<5PYld2lx&tFPM(oZ>HO06F9-Vpzrs
qiFoo+BnG5Dk-Q%w{YJSM{`l#C{M49VAdFXEjj(HxUB@K50sI09Sf2R+
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesController.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesController.class
deleted file mode 100644
index 63ce085e5ddf8cc1e9b31320983ff2826e33e813..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1600
zcma)6TTc@~6#k|_OG^4uhK*`
z`rr@nM;Xs9-7cD%?90wMGv|EgJC{Abe*gFhU>h45BruS|U=~A2GK`-X=LWY7yUF(&
zC&JVW$t`J1y~8k&FVxc*MmmK|79+?qEGx%6b@@lxHk~8EtFNlOqO>$E;r4{8V{7GD
zmQV~iqx-rq+Kwx=qdqY3S`3uPq3mO
zF9&r?64hAUjAnxJnBDhmEzd+$tJ&h=Bg*1A7jYZ+v;ac4M#>2!
zs_$e=>-Hw+mfz5pfBouL
zmwn;t$el>_Z*_my_a1piWli&N4d5;
z$BN&;ii;OW6_+kB`kAg0xIAqV
z1gFh(j}RGIupmmf522T8qmJgqSh=Ab=gbUJo5_46oi6h~WE9S|Cy4aFZ1A-9!q7Wi
zw(j3qW~aNQHNyJmxe2;ZBkeVhJ21uu8MHM#?NyrDLYzq-l>1iXVkUV7)(Cko5+67}
zoEq!YCuc7eZ$x>X+SL_zYA%fZYU;dpA~cVb5AUrHG1duN|Mn6>=g=7Cl3aSP*i>Wj
zAUsFR-v~Z6w9u|@%M}u+{8)}1W(6ZLF1`E#`d-Pp9LqBB1S=dn3juoQa~9zN#~KEB
b$hge4M|>WCVex8JSi@7sHj^>d@C>crxvrG9
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesDTO.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesDTO.class
deleted file mode 100644
index 420679bb3295c42ca6b701cd2c56a2bb2b234053..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2381
zcma)-ZByGu5Xbinench&5*ivB67o<34Qlg50|}{PN^0UjCL!)j-wAOwN8}SD$w{Z5
zs-0;kGkwty&=1w=e@_M%ah~CYwYUG5jXzcPRZtP~nNvDp?maQd?-3sYK->RU8^4N6?)p^xwzsujLMo
zqWnO{CxeaM9YHy@FKDtg*!^u1DcxD){l*=-z?+R~uPa%&=+Gn!1+SMJgb_=Z9J
zK2b?vf*~{d&UTHyyggdeIMcA~l~s4ttR=1ueDCaoV>gcnzm%AR~eEDB(YC3V^
z^PaB<7n1IIN~j>BaeOruEFU;&>Ngd0P8^pZlC{iLCurtPPbaD?+bUK_d|m4>@wjS`
z_m!3(cHN)7IFZpW-M~HcP}ZS#y^|n!3x2bs!$`i4!Xt?)mocuPs*Ltdzt`bMJ%XkZ
zsL5>^C$A)5dR(L*1l>JH<$&~7dIUjEQ)?MD0xymw@CvDpiY=jCiMVNR(;bX*+$qMQ
zJ&Z+D7>gz_7R7HYs@+&rx3TD7W6^rBQ-qSC0-j&Ob72K+e(@8D-%VHzPo5?!(gL1N
z8bFJ*1W(XcbQjOli~peFZT=}#(VUp;G9Pp1+6S2Gr$
zg^9nmLR7O5*Q^lV*deM}h`AvUoJfYaXN8!^Ld;ts?w>%c|34EG0|>r*!rkYQY`%!I
z+2D#`kOx+fsVvB%7385EWGV}?3=nq+2$v*-JhFmJXF={+L00S_(^-&509hFV!aczt
z-RtvLLHgkjHkAnJmaUK%NZ&;ihDeRV&DB7Ua1VWX%pTn+4ef$crH${8eC(CsvTT
zEXbA>8uLxhK{k*xB`&r7$q
zvu0%A3eGPrN=|jl%mF$^92N)&*Xn_s2lOZ-12Yh_0>hAjfr)_~OmZ-Af@v-QP;+op
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesSource.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Articles/ArticlesSource.class
deleted file mode 100644
index a93605a9356899dabeec03fbc8cb193cd7f7df24..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 945
zcma)4-AWrl7(KH|c5Av;YogZLpY*DULiYjE3KCi<4Hjz2{bV!5(PUP3CtmneEwl(;
z_y9gs>6y)Hz-*x`%=dl6IcLtC+1o$YHvm4MRfmU4fNF>ue1Y{-c_E{TG~?*&@KnWC
zz<;lewg&>0c4x4HM_36^5AhhGKqpP&vn;yQ=W#MpQSVDHI!vvOCn~#dj+0p$D}kz!
zQzE
z%{SkS3_g=4ozc96+
A3IG5A
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/Category.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/Category.class
deleted file mode 100644
index 2a4a4481615bc0dcd3a3b526892daa93ac3dcdb2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1203
zcma)5?M@Rx6g{*3SUw7cQWOvcfnr;Y`v543sc0G-Or&YT&!wHzfp)jqoto6A(nMn7
z4y^)0w$5_uO;No!K8hzkLVr9JM)E$k@mhkV9Tz>D>L`Is@11J8#d<
zWmgO2pD9o2LxD`S)|tf&W^K$BFpq-3Zs2z>Lg%9zb^V@n8gCj-!_~6y2a~IXfTen@
z+`2B^^1c3nDYaNY5laGD&mBsEQX=O>2Z~t&>+i;%RzulQp*kDL7oO*9S1aEO1=a|-
za0Bf+BN>D$)Y9upr`aQHFZJlP^khJVy^cE=OQy|)+Qj|IKM>?=Peu`<`SR$v-E5x<
zY^HKF{K0tWv38}J@Dq7X#8ZE@4&67{Jb_|MdGdHXJd;7&rBl-nzv~V9JblHR+M;BAR0lvB#oA5YcHCZ5GZSKS$
z2VMC}89NKV-^Nq(6mDzZ5pP>h4)Bog!{Q^g_~T=Pz%rv{MkUTGjLQU&5|Gxx~U}ZdusiSVETLGRG2TNwA1A?r~>3
zhG7%;8L_}rj#(LIE21%EhQ{G6IOhz_b#ZeHiZum|7bZ*#3Ov9TcW#2e!2ZOfSXm6-
zNCj`RQ8Du;_E1R^l4x)&
ZWS>GF-6ABuNDKQEXfey&xG`S^egPKA<)Z)q
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryController.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryController.class
deleted file mode 100644
index 28b7640f9e11bb557e0fe56416bed9e28d0dba66..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 3501
zcmcImZFAd15Pr^0qS&ZTuuV##Kwk*8ous0rX#k}uiTf7fHpVW74h(~AUmdlMWF$GB
z!0?&B0}P}yFvAbvM=|V4mgJ@~b1>zD<2&bepJ#WU-Mc^k`t1(@*YPle6iz6ZQZbDg
zhWW?FfuZ#btE=s{9`m-xFtcu2rnkXxqF8FCF^jZXi>2(`+w?l34WcMi-pXIQREm^OmbdInj{DVSIBGI9)Mc~hd_<=$qm
z$FNW=RpaQkJ?}ht#y%g~&J%6V^ZHtyyM5bo`7O&cy+c7{
zLB%P&$}r{b*+Yi4;+WT}ZFTjMOlW!j_HyJKWWN?>gG(5u_xD2V?9frlK
z#97K&9%n^W&oOL_a}4UL%Q&e}QT0+&M14WU+gPM@wjE9tW~dgW!jwyfK)9%)h!P9zW?wMkl8R-l5Mqb-xQJ=-ImB_vY}s~?8{2A9U_$
zpqQMzr5k3~qE>Jy71tB{d0i$6`Ubhbn#gR(TUyJsI^(47aPOYc@6&J~vuo03;po`1
zJBMUAN8yCSaqDoq!=NX~ZDMPO-hx3y{!%8nm_I&z7+U|`t9lj=ko$?|!f4I>hhR^p~1TEiF2
zLcR{GiGd}FxMsU!Do#grW03bz=idyt>x~4R4F+{wjIWcz+O>utspCRNkFF!tN
zgR#Ub9ZH~MANtabpChA(gQQB=$GSeemBdI}lUBn`|Hg}_TBczSoHoC0ic98HSkm~i
zxFo1fn&wGzqjBZM=EN=eB1ks%RTh%NIeK%Z=(S2CPrN#5HACxZT%x^3yP9~y(s!o(
z6s)}TE0mvTm%_XBH|zf=k0}(8#sV(WZ)bzkxPtd+M|Qqf=C7_|l`OB(T41cvH!(+!
zECkXO+KF?ss&-eJ4V%#_0Ea^!wNy#a^dMis}`j*q4v+PBQ%EvHBIF
z;0vSR$p-|H)F=(Lh{z`qksu8xQ&AcMI`w}nMLC(x>V#yBm!c7IcyNqEREiWnrSMZ|
Q`bTrL`i%CUN5`vw1L1_{F#rGn
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryRepository.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryRepository.class
deleted file mode 100644
index d48fdc4fe4fb2038ab438df59d1ef8ffb54312af..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 436
zcmb7B!Ab)`41H6zYpa4c@f$=3ysiqe;Kc=@1@F_{I83{pESXuQfg|1CBTGs8lkgo386h>2Ly@{QW!c+N^H!uIs
zc~<^mq5RvZlD*9@a)t4fJE`c(HA&3D*AaTPCm-?@4kw+DZb`Q;xLHG&-g7k3u@4GI
ozX}eKggCBR(mh+APNuMtY%6^O31!I-u#M4Y9AhWNVXE%}@6%O`ZvX%Q
diff --git a/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryService.class b/out/production/BrandonGrahamDay/rocks/zipcode/CKC/Category/CategoryService.class
deleted file mode 100644
index 503618386f2e7d34ac9bb8dc0165198f1accd887..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2212
zcmb7GTUQ%Z7~Lm?1j3Y%K&e=Jv9&Y_(9v3LHGn`Y6&pcGjhE%ikQ~y}4l`LZ6Il4_
zAJVlH#RpfP{ZTIWnM`g#*GgYz^3CjTfBUo{SSZ@{E$KnBT2*!j3Oa0^};%|
zOxtoA=FZ*=SqlUb%gRx~s=!DtUmeF7#*;`Hn1CTr@Z8!<-~3rMYi?bdrKcscWCgO}
zddJ-#73m$SniR;^qF1}J>G~=lNWd%)LD6$4PGA!0B&G~xkQG>ZBX5D^zH;j8wk