NetWurst
NetWurst

Reputation: 17

Render whole page as JSON content instead of HTML with Nuxt.js

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:

Would be VERY happy, if somebody could tell me whether this is possible AT ALL or not?

Upvotes: 0

Views: 1151

Answers (1)

kissu
kissu

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

Related Questions