content icon indicating copy to clipboard operation
content copied to clipboard

When support fetch data from MySQL?

Open alaxcc opened this issue 8 months ago • 1 comments

Most websiste based on MySQL, and nuxt/content still can't fetch data from mysql?

Do you have timeline to support it ? thanks!

alaxcc avatar May 11 '25 11:05 alaxcc

  • If you want to load markdown content from MYSQL database and load it into Nuxt Content, you can create a Custom Source for your collection and feed module.
  • Or if you want to connect Nuxt Content to your MYSQL database, we can support it by adding db0's MySQL adapter here

Or do you need something else?

farnabaz avatar May 13 '25 10:05 farnabaz

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jul 12 '25 10:07 github-actions[bot]

Hey @farnabaz . I came across this issue, while searching for (mostly) the same thing.

The goal is to have a private page (server-side) behind authentication, retrieving from MYSQL, PGSQL, API endpoint, etc. The Custom Source from Content wouldn't work, because it loads all the documents upfront, and thus, not private.

In the end of the day, the missing feature would be a SSR page, example app/pages/secret/[...slug].


<script setup lang="ts">
definePageMeta({
  layout: 'docs'
})

// Pseudo code to find auth/permissions

if (! notAuthorized) {
  throw createError({ statusCode: 403, statusMessage: 'Forbidden', fatal: true })
}

// pseudo-code to retrieve from DB/etc

// const page = ---->   we would get the metadata (frontmatter top), and the Markdown (frontmatter body)

const title=page.title
const description=page.description

useSeoMeta({
  title,
  ogTitle: title,
  description,
  ogDescription: description
})

// const content =  ----> How to render page.markdown? Pass to some function??

// How could we then render it?
<template>

      <ContentRenderer
        :value="content"
      />

</template

ijpatricio avatar Jul 28 '25 11:07 ijpatricio

Yes, a complete approach for authorization in nuxt content is still unclear. We are discussing here but running into many issues: https://github.com/nuxt/content/discussions/1532#discussioncomment-14128987

oripka avatar Aug 18 '25 06:08 oripka

Thanks for the update, @oripka

ijpatricio avatar Aug 18 '25 17:08 ijpatricio

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 17 '25 17:10 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Nov 16 '25 17:11 github-actions[bot]