Last active
November 30, 2022 11:46
-
-
Save nathanclevenger/b90122a628424ad543e6e5049f6eeedf to your computer and use it in GitHub Desktop.
Generate APIs.do Markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
fetch: async req => { | |
// Fetch YAML of Categories, transform to JSON | |
const apis = await fetch('https://yaml.do/raw.githubusercontent.com/drivly/apis.do/main/apis.yaml').then(res => res.json()) | |
let md = ` | |
# APIs.do: Hypermedia-driven APIs & SDK | |
` | |
// ### Core: | |
// - [APIs.do: Hypermedia-driven APIs](https://apis.do) ([API](https://apis.do/api), [Docs](https://apis.do/docs), [Repo](https://github.com/drivly/apis.do), [Roadmap](https://github.com/drivly/apis.do/issues/1), [Issues](https://github.com/drivly/apis.do/issues)) | |
for (const category in apis) { | |
md += `### ${category}:\n` | |
for (const api in apis[category]) { | |
const host = api.toLowerCase() | |
md += ` - [${api}: ${apis[category][api]}](https://${host}) ([API](https://${host}/api), [Docs](https://${host}/docs), [Repo](https://github.com/drivly/${host}), [Roadmap](https://github.com/drivly/${host}/issues/1), [Issues](https://github.com/drivly/${host}/issues)) \n` | |
} | |
md += `\n` | |
} | |
// Loop through categories and APIs and generate markdown | |
// ### Core: | |
// - [APIs.do: Hypermedia-driven APIs](https://apis.do) ([API](https://apis.do/api), [Docs](https://apis.do/docs), [Repo](https://github.com/drivly/apis.do), [Roadmap](https://github.com/drivly/apis.do/issues/1), [Issues](https://github.com/drivly/apis.do/issues)) | |
return new Response(md) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://b90122a.workers.do (Redeploy)