sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7k stars 434 forks source link

Custom routes #1714

Closed AlexRMU closed 3 years ago

AlexRMU commented 3 years ago

Why can't I add paths explicitly? Why automatically through folders and files? Now:

src/routes/index.svelte -> /
src/routes/about.svelte -> /about
/blog/[slug]/[language].svelte -> /blog/${slug}/${language}

And if I want it like this:

routes/old/main/1/index.svelte -> /
src/new/about/about2/about.svelte -> /about
src/new/about/about2/about.svelte -> /about2
/blog/[slug]/[language].svelte -> /blog/${language}/${slug}
/blog/44/en.svelte -> /error44

In fastify/express I can do this:

fastify.route({
        method: "GET",
        url: "/*",
        handler: handlers.index
});
fastify.route({
        method: "GET",
        url: "/about",
        handler: handlers.about
});

where handlers.index and handlers.about are functions that return the content I need

Well, or I did not understand the documentation

antony commented 3 years ago

As detailed in the bug template which you sadly deleted, we can't provide support via github issues. Please come and chat on discord.