Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

processing dynamic order - logic bug #12

Open
landsman opened this issue Jun 22, 2020 · 0 comments
Open

processing dynamic order - logic bug #12

landsman opened this issue Jun 22, 2020 · 0 comments
Labels
bug Something isn't working hacktoberfest

Comments

@landsman
Copy link
Member

There is missing some kind of logic which will check all aliases in array and would prefer static one instead of dynamics pages.


URL: http://localhost:3000/cs/autorizace

This order will cause 404 on template: /[code].
Routes:

const paths = {
    homepage: "/route:homepage",
    typeAmount: "/route:venue",
    auth: "/route:auth",
};

// Used at server
const routes = [
    {
        id: paths.homepage,
        template: "/",
        aliases: {
            cs: "/cs",
            en: "/en"
        }
    },
    {
        id: paths.typeAmount,
        template: "/[code]",
        aliases: {
            "cs": "/cs/:code",
            "en": "/en/:code"
        }
    },
    {
        id: paths.auth,
        template: "/auth",
        aliases: {
            "cs": "/cs/autorizace",
            "en": "/en/authentication",
        }
    }
];

module.exports.paths = paths;
module.exports.routes = routes;

This will be processed just fine, without 404.
Routes:

const paths = {
    homepage: "/route:homepage",
    typeAmount: "/route:venue",
    auth: "/route:auth",
};

// Used at server
const routes = [
    {
        id: paths.homepage,
        template: "/",
        aliases: {
            cs: "/cs",
            en: "/en"
        }
    },
    {
        id: paths.auth,
        template: "/auth",
        aliases: {
            "cs": "/cs/autorizace",
            "en": "/en/authentication",
        }
    },
    {
        id: paths.typeAmount,
        template: "/[code]",
        aliases: {
            "cs": "/cs/:code",
            "en": "/en/:code"
        }
    }
];

module.exports.paths = paths;
module.exports.routes = routes;

@landsman landsman added the bug Something isn't working label Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant