sveltin new resource
Command to create new resource (route).
Command used to create new resources.
Why “resource” instead of “route”? Although a resource is basically a route on SvelteKit router, a resource is not an empty route. The retional behind the name is related to the fact that to serve content a route alone is not enough. To name a few, we need libs, pages, endpoints, a place to serve static contents like images for the content belongs the route etc.
That’s why “resource”, all you need to group, serve and expose the content’s route.
- Create a
folder within “content” folder, so that you can add new content for the resource
- Add the resource as route within the “src/routes” folder, creating its own folder
- Scaffold a GET endpoint for the resource within “src/routes/api/
- Scaffold +page.svelte component and +page.serve.ts endpoint to list all the content belongs to a resource
- Scaffold [slug]/+page.svelte component and [slug]/+page.ts endpoint to get access to a specific content page
sveltin new resource [name] [flags]
-g, --group string Group name for resource routes (https://kit.svelte.dev/docs/advanced-routing#advanced-layouts) -h, --help help for resource --slug Use a different layout for the slug pages (https://kit.svelte.dev/docs/advanced-routing#advanced-layouts-layout)
- sveltin new - Create new resources, pages and themes.
Last updated: 07-Feb-2023
Apache 2.0 License @ 2021-present Sveltin.io and contributors .
The Sveltin logos are copyright © Mirco Veltri.