TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: API layer (e.g., GraphQL) over Markdown files

2 点作者 curo超过 4 年前
Been trying to figure this out for two days and must be thinking about it incorrectly. I&#x27;d like to support the following workflow:<p>- write in markdown with YAML frontmatter (or similar)<p>- query files and frontmatter from different apps &amp; sites through an API (ideally GraphQL)<p>It seems this word is divided into two segments:<p>1. Git-based CMS like Forestry, Grav, Netlify which allows you to source from git flat files, modify and deploy in their ecosystem as a static site<p>2. Headless CMS&#x27;s like Contentful, Strapi, etc that expose an API layer atop their CMS database (or in the case of Hasura, atop Postgres, MySQL, etc)<p>There are many examples of sourcing content from a headless CMS to a static site or git-based CMS, but not vice-versa. For example, you can have a Gatsby + Contentful site deployed on Netlify, but in this case, you&#x27;re sourcing front Contentful to Gatsby (which can also source from flat files &#x2F; git), but you can&#x27;t then fetch them from a third party app.<p>I already maintain my content in git as markdown, and my aim is to fetch that content (paginate, filter by frontmatter, etc) in a Nuxt app, in Webflow, on a blog (e.g., static site). I could potentially fetch the various repository&#x27;s files through Git&#x27;s API, but then I&#x27;d have a ton of client-side logic in each app or place I&#x27;d like to use that content.<p>Effectively I&#x27;m looking for how to set up a thin API layer over flat files (hosted on Git or otherwise). Like a Hasura with markdown as the source. Like a Headless CMS that can source and&#x2F;or sync with flat files. (Or to set this up myself.)

2 条评论

praveenweb超过 4 年前
Have you tried using Gatsby&#x27;s GraphQL API as a standalone server? The dev server in Gatsby lets you use the GraphQL endpoint running at `___graphiql`. I wrote about this in <a href="https:&#x2F;&#x2F;hasura.io&#x2F;blog&#x2F;data-federation-in-graphql-using-hasura-remote-joins-and-gatsby&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hasura.io&#x2F;blog&#x2F;data-federation-in-graphql-using-hasu...</a>
gigatexal超过 4 年前
Would this require a schema of sorts for the markdown files so the API could inspect or parse the files in a structured way? Something akin to a template?
评论 #26214726 未加载