#multiple rest pages living in same directory kinda works but not cached - astro bug or unsupported?

2 messages · Page 1 of 1 (latest)

hollow tangle
#

i have the follow file structure for an api reference site that displays a single long list of resources that can be expanded client side:

- pages
    - api
        - [...page].astro
        - [...section].astro

[...page].astro is the full list of resources and some js that allows retrieving a partial=true [...section].astro and inserting it to allow sections to be expanded. the static paths in section are identical to page except they add a ".section" suffix.

that works great but the performance is terrible and that lead me to verbose logging which shows messages like "Unexpected cache miss [...]". adding an additional log message at that point to list the known keys shows none of the ".section" variants exist.

i tried changing the ".section" path suffix convention i'd been using to "_section", but the only thing that worked was moving [...section].astro to a separate directory e.g. pages/api/sections/[...section].astro.

is this an astro bug or is this type of thing not allowed?

hollow tangle
#

spoke too soon - the log messages go away but performance is still terrible:

...
  vite:transform 5.07ms src/pages/api/sections/[...section].astro +8s
06:50:16 [200] /api/sections/product.section 6ms
  vite:time 11944.15ms /api/sections/product.section +20s

i guess i have something more going on here