kit icon indicating copy to clipboard operation
kit copied to clipboard

SSR Only Routes

Open itswellknown opened this issue 3 years ago • 9 comments

Describe the problem

In the fine-print of many API services, there is a clause to not re-distribute the data of the service API in another API. Sometimes parts of our apps will need to use these third-party data-sources. We may not necessarily have the license to distribute said data as json.

Another example: needing to show advertisement along with articles! We don't want someone to directly access our API and just read articles without our ability to monetize with ads! With full HTML render, ads will also be sent along.

Describe the proposed solution

SSR-only routes--routes without __data.json or that do not respond to application/json request headers, insure that we are not re-distributing API data in a way licensing does not allow.

Old school SSR. No API endpoints. Also, all endpoint point to this route should not try __data.json. With regard to prefetching, the browser does have a <link rel="prefetch" href="foo/bar" /> option, and perhaps a mouse over could get the browser to start a prefetch the HTML5 way for SSR only routes.

SSR-only routes living along side with smart hybrid rendered routes. It would be glorious.

Alternatives considered

Hand-crafting GET exports to fail on JSON requests use a proxy server to prevent JSON content going out from certain routes. Bleh.

Also needing to place sveltekit:reload on all inbound links as well. May even need to write custom logic to include HTML5 prefetching as well (ie, <link rel="prefetch" href="foo/bar" />). Tedious bookkeeping. Would be great if there was a compiler that could do this for us.

Importance

would make my life easier

Additional Information

No response

itswellknown avatar Jul 25 '22 04:07 itswellknown