nuxt / framework

Old repo of Nuxt 3 framework, now on nuxt/nuxt

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to handle Custom Routes dynamically in Nuxt3 at nuxt.config.ts?

Hari111142 opened this issue · comments

Describe the feature

Hi Team,

I can able to route statically using this custom routes but I need to route dynamically using the path that I get from the API.

Static Custom route from nuxt.config.ts
hooks: {
'pages:extend' (pages) {
pages.push({
name: 'Article',
path: '/sample/content/article',
file: resolve(__dirname, 'pages/article')
})
console.log(pages);
}
},

API Sample code:
{
"pageProperties":{
"path":"/sample/content/article",
"templateName":"article",
"title":"Sample Title",
"type":"content/components/page/article"
},
}

Thanks in Advance

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks