21 lines
649 B
1
import type { ClientRequest, ServerResponse } from 'node:http'
2
3
export default async (req: ClientRequest, res: ServerResponse) => {
4
const response = await fetch(
5
'https://ungh.cc/repos/barelyhuman/minweb-public-data/files/main/data/links.json'
6
).then(d => d.json())
7
8
let data = []
9
try {
10
data = JSON.parse(response.file.contents)
11
} catch (err) {
12
console.error('Failed to get data')
13
}
14
15
const filterItemsStillInProcessing = data.filter(d => {
16
return d['dimensions'] && d['imageURL'] && d['addedOn']
17
})
18
19
res.setHeader('Content-type', 'application/json')
20
return res.end(JSON.stringify(filterItemsStillInProcessing))
21
}
22