Nuxt.js: _page.json return empty JSON object

Created on 7 Apr 2019  ·  1Comment  ·  Source: nuxt/nuxt.js

Version

v2.4.0

Reproduction link

https://brotli.pro/benefits.json

Steps to reproduce

Add .json to any SSR pages

Eg: /apples ---> /apples.json

What is expected ?

Nothing ¯_(ツ)_/¯
but.. it could be nice to return specific data as JSON object

What is actually happening?

Return empty JSON Object : {}

Additional comments?

Bug or maybe a future awesome feature :thinking:

Shopify do the same with /orders ----> /orders.json and it's awesome for debugging

This bug report is available on Nuxt community (#c9010)
bug-report

Most helpful comment

Thanks for reporting! It's not related to pages though but generally to 404 requests (Depending on the extension/data type).

It's a feature of https://github.com/nuxt/serve-placeholder to reduce workload for 404 requests so they don't go through the whole Nuxt SSR cycle, e.g. for robots.txt, json, images and so on.

You can also disable that behavior (if you really want to) through https://nuxtjs.org/api/configuration-render#fallback ☺️

>All comments

Thanks for reporting! It's not related to pages though but generally to 404 requests (Depending on the extension/data type).

It's a feature of https://github.com/nuxt/serve-placeholder to reduce workload for 404 requests so they don't go through the whole Nuxt SSR cycle, e.g. for robots.txt, json, images and so on.

You can also disable that behavior (if you really want to) through https://nuxtjs.org/api/configuration-render#fallback ☺️

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uptownhr picture uptownhr  ·  3Comments

pehbehbeh picture pehbehbeh  ·  3Comments

shyamchandranmec picture shyamchandranmec  ·  3Comments

gary149 picture gary149  ·  3Comments

msudgh picture msudgh  ·  3Comments