funk2351
funk2351
NNuxt
Created by funk2351 on 7/25/2024 in #❓・help
Server middleware for specific route
Hi, i have this structure: - /pages/page/[...slug].vue - /pages/component/[...slug].vue And i want to make server middleware only for these routes, how can i do this? I was trying with this solution: - /server/routes/page/[...slug].get.ts - /server/routes/page/[...slug].post.ts but it's nor working. Can you help me?
5 replies
NNuxt
Created by funk2351 on 7/15/2024 in #❓・help
How to return/render a Page/Component through API call?
Is this possible in Nuxt 3 to return/render certain Component on server side via api call?
- server
└── api
└── component.ts
- components
└── form.vue
- server
└── api
└── component.ts
- components
└── form.vue
export default defineEventHandler((event) => {

// render the specified component
return renderMethod('components/form.vue')
});
export default defineEventHandler((event) => {

// render the specified component
return renderMethod('components/form.vue')
});
Could someone guide me through the process or provide an example of how to accomplish this in Nuxt 3?
1 replies