2017-03-15 14:24:54 +00:00
|
|
|
const UrlPrettifier = require('next-url-prettifier').default
|
|
|
|
|
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
page: 'index',
|
|
|
|
prettyUrl: '/home'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
page: 'greeting',
|
2018-12-17 16:34:32 +00:00
|
|
|
prettyUrl: ({ lang = '', name = '' }) =>
|
|
|
|
lang === 'fr' ? `/bonjour/${name}` : `/hello/${name}`,
|
2017-03-15 14:24:54 +00:00
|
|
|
prettyUrlPatterns: [
|
2018-12-17 16:34:32 +00:00
|
|
|
{ pattern: '/hello/:name', defaultParams: { lang: 'en' } },
|
|
|
|
{ pattern: '/bonjour/:name', defaultParams: { lang: 'fr' } }
|
2017-03-15 14:24:54 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
const urlPrettifier = new UrlPrettifier(routes)
|
|
|
|
exports.default = routes
|
|
|
|
exports.Router = urlPrettifier
|