1 | import fetch from "isomorphic-unfetch";
|
2 | import { hnApiBaseUrl } from "./hn-api-base-url";
|
3 |
|
4 | /**
|
5 | * `getAskStoriesIds` returns the list of up to 200 IDs of the "Ask HN" stories.
|
6 | *
|
7 | * @see {@link https://github.com/HackerNews/API#ask-show-and-job-stories}
|
8 | */
|
9 | export async function getAskStoriesIds(): Promise<number[]> {
|
10 | const endpoint = `${hnApiBaseUrl}/askstories.json`;
|
11 | const res = await fetch(endpoint);
|
12 | const ids = await res.json();
|
13 | return ids;
|
14 | }
|