Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How can I programmatically generate SvelteKit routes?

$
0
0

I've been working on a simple CMS with SvelteKit. I want authenticated users to be able to create new pages or layouts within the application. I'm not sure if this would require the actual generation of +page.svelte or +layout.svelte files programmatically, or some way of dynamically loading routes from data (almost as if there was an equivalent of loading a list of components with an #each block, but for whole pages with their own url routes). Right now I'm storing data in JSON, along with the content for each page. It also seems a bit silly to create a bunch of empty directories simply for routing and layout inheritance purposes when all my data is already stored in JSON.

Would I do this using something like Node's File System API, or is there a SvelteKit specific way to generate directories, or load file routes dynamically from data?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>