const story = (path: string) => `https://node-hnapi.herokuapp.com/${path}`; const user = (path: string) => `https://hacker-news.firebaseio.com/v0/${path}.json`; export default async function fetchAPI(path: string) { const url = path.startsWith('user') ? user(path) : story(path); const headers = { 'User-Agent': 'chrome' }; try { let response = await fetch(url, { headers }); let text = await response.text(); try { if (text === null) { return { error: 'Not found' }; } return JSON.parse(text); } catch (e) { console.error(`Recevied from API: ${text}`); console.error(e); return { error: e }; } } catch (error) { return { error }; } } ();'> Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/examples/subpath (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2022-07-21fix: provide hint for undefined exports (#4003)Gravatar Nate Moore 1-1/+3
Co-authored-by: Nate Moore <nate@astro.build>
2022-07-21[ci] formatGravatar matthewp 7-16/+17
2022-07-21Replace/Rename Astro.canonicalURL with new Astro.url helper (#3959)Gravatar Fred K. Schott 35-117/+101
* add Astro.url * Add examples of how to create the canonicalURL Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2022-07-21Fixes using tsconfig to set aliases (#4010)Gravatar Matthew Phillips 9-4/+102
2022-07-21[ci] formatGravatar natemoo-re 1-52/+52
2022-07-21fix: better dev routing with base using middleware (#3942)Gravatar Allan Chain 8-42/+157
2022-07-21[READMEs] removed "experimental" from astro add instructions (#4004)Gravatar Sarah Rainsberger 6-5/+14
2022-07-21[ci] formatGravatar natemoo-re 1-2/+6
2022-07-21Support objects for `style` attribute (#3776)Gravatar Nate Moore 2-2/+15
* feat: support style objects * chore: update jsx types * feat: support className for better JSX compat Co-authored-by: Nate Moore <nate@astro.build>
2022-07-21[ci] formatGravatar matthewp 1-5/+1
2022-07-21Make the Lit integration be compat with Vite 3.0.1 (#4009)Gravatar Matthew Phillips 4-11/+15
* Make the Lit integration be compat with Vite 3.0.1 * Changeset * Pin Vite version * Update lockfile
2022-07-21[ci] formatastro@0.0.0-rc-20220721064837@astrojs/vue@0.0.0-rc-20220721064837@astrojs/vercel@0.0.0-rc-20220721064837@astrojs/svelte@0.0.0-rc-20220721064837@astrojs/node@0.0.0-rc-20220721064837@astrojs/netlify@0.0.0-rc-20220721064837@astrojs/mdx@0.0.0-rc-20220721064837@astrojs/markdown-component@0.0.0-rc-20220721064837@astrojs/image@0.0.0-rc-20220721064837@astrojs/deno@0.0.0-rc-20220721064837@astrojs/cloudflare@0.0.0-rc-20220721064837Gravatar bholmesdev 2-18/+20
2022-07-20[MDX] Support YAML frontmatter (#3995)Gravatar Ben Holmes 11-13/+348
* chore: remove old comment * deps: add remark-frontmatter * deps: add remark-mdx-frontmatter * fix: handle null or undefined frontmatter key * feat: configure frontmatter plugins with defaults * test: frontmatter and custom frontmatter name * docs: add frontmatterOptions config * docs: add "variables" and "frontmatter" docs * chore: excessible -> accessible * chore: changeset * chore: remove bad mdx comment
2022-07-20Properly support and type optional props in Svelte components (#3993)Gravatar Erika 2-6/+9
* Properly support and type optional props in Svelte components * Change output to support documentating components * Add changeset
2022-07-20[ci] formatGravatar FredKSchott 1-1/+1
2022-07-20Update snapshot release instructionsGravatar Fred K. Schott 1-9/+16
2022-07-20Updates SSR routing to always give priority to public assets (#4000)Gravatar Tony Sullivan 4-0/+20
* matchRoute should ignore requests for public assets * chore: add changeset
2022-07-20[ci] formatGravatar matthewp 2-5/+6
2022-07-20Move the Markdown component to its own package (#3986)Gravatar Matthew Phillips 116-719/+1392
* Move the Markdown component to its own package * Update the examples * Updated lockfile * Use is:raw * Add a main field * Update the formatting of the readme * Rename to @astrojs/markdown-component
2022-07-20[ci] formatGravatar matthewp 1-2/+1
2022-07-20Removes warnings / flags for integrations and ssr (#3992)Gravatar Matthew Phillips 8-102/+8