17 lines
513 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
res.setHeader("Content-type", "application/json");
16
return res.end(JSON.stringify(data));
17
};
18