N
Nuxt6mo ago
Tumulte

registerEndpoint returning data from a previous registerEnpoint

I have 2 end points for a test...
registerEndpoint('/api/channel/preview', {
method: 'POST',
handler: () => {
return { query: 'query', content: posts };
},
});

registerEndpoint('/api/channel/preview/translator', {
method: 'POST',
handler: () => {
return { prompt: 'new prompt' };
},
});
registerEndpoint('/api/channel/preview', {
method: 'POST',
handler: () => {
return { query: 'query', content: posts };
},
});

registerEndpoint('/api/channel/preview/translator', {
method: 'POST',
handler: () => {
return { prompt: 'new prompt' };
},
});
but when I call the second enpoint, it gives me the data from the first {query:... content:...} however if I swap their position in the test code to match the order they are called... it works I don't understand why the position should matter and the documentation says nothing
2 Replies
dmarr
dmarr2mo ago
Did you ever find a reason for this? I am hitting the same issue
dmarr
dmarr2mo ago
GitHub
registerEndpoint fails to register on deep paths · Issue #956 · nux...
Environment Operating System: Linux Node Version: v18.20.3 Nuxt Version: 3.13.2 CLI Version: 3.13.2 Nitro Version: 2.9.7 Package Manager: [email protected] Builder: - User Config: compatibilityDate, devto...
Want results from more Discord servers?
Add your server