Last active
January 9, 2019 17:10
-
-
Save AndrewIngram/04c1901eb5c461961ab3f6ae68d1ae98 to your computer and use it in GitHub Desktop.
Router API Idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { routes, include } from "@framework/router"; | |
import { relayView, xmlView } from "@framework/engine"; | |
const gbRoutes = routes( | |
route({ path: "/", view: "./views/gb/HomepageGb" }), | |
route({ path: "/scooter/", view: "./views/gb/ScooterGb" }), | |
route({ path: "/car/", view: "./views/gb/CarGb" }), | |
route({ path: "/private-hire/", view: "./views/gb/PrivateHireGb" }), | |
route({ path: "/blog/:slug/", view: "./views/BlogPost" }) | |
); | |
const esRoutes = routes( | |
route({ path: "/es/", view: "./views/gb/HomepageEs" }), | |
route({ path: "/es/scooter/", view: "./views/gb/ScooterEs" }), | |
route({ path: "/es/car/", view: "./views/gb/CarEs" }), | |
route({ path: "/es/private-hire/", view: "./views/gb/PrivateHireEs" }), | |
route({ path: "/es/blog/:slug/", view: "./views/BlogPost" }) | |
); | |
export const config = { | |
defaultEngine: relayView, | |
notFound: { view: "./views/NotFound", engine: relayView } | |
}; | |
export default routes( | |
include(esRoutes, { country: "es", language: "es" }), | |
route({ | |
path: "/sitemap.xml", | |
view: "./sitemap/generateSitemap", | |
engine: xmlView, | |
serverOnly: true | |
}), | |
include(gbRoutes, { country: "gb", language: "en" }) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment