Skip to content

Commit

Permalink
Add filtering to hackmd express server
Browse files Browse the repository at this point in the history
  • Loading branch information
DemogorGod committed Oct 4, 2023
1 parent f41867e commit b3968a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion apps/landing/src/pages/blog/Blog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ watch(activeHTMLBlog, async () => {
})
onMounted(async () => {
try {
const response = await fetch('http://localhost:3003/api/hackmd')
Expand Down
11 changes: 8 additions & 3 deletions services/blogs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ app.get('/api/hackmd', async (req, res) => {
}

const data = await response.json()
// console.log("data:", data);
res.json(data)

const filteredData = data.filter(
(item) => item.tags.includes('blog') && item.publishedAt
)

console.log('filteredData:', filteredData)
res.json(filteredData)
})

app.get('/api/hackmd/:id', async (req, res) => {
Expand Down Expand Up @@ -60,7 +65,7 @@ app.get('/api/hackmd/:id', async (req, res) => {
}

const data = await response.json()
// console.log("data:", data);
console.log('data:', data)
res.json(data)
})

Expand Down

0 comments on commit b3968a9

Please sign in to comment.