TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

2 pointsby curoabout 4 years ago
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 comments

praveenwebabout 4 years ago
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>
gigatexalabout 4 years ago
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 未加载