Reputation: 17
Currently my Nuxt.js application serves HTML pages defined in layouts, pages, routes and components.
Is it possible to render one single route / one page as a standard JSON Response? Is that possible? I mean do not render the HTML e.g. Tags - only pure JSON!
What I already tried:
<pre>{{jsonObject}}</pre>
hoping to get plain JSON, no success.Would be VERY happy, if somebody could tell me whether this is possible AT ALL or not?
Upvotes: 0
Views: 1151
Reputation: 46677
What you're looking for here, is an API.
Vue.js will render a template (compiled to render functions, generating a DOM tree) at the end, because it's aimed towards a frontend usage. If you want to render something like an API response with pure JSON, you need to look into Express or alike.
Upvotes: 2