next-routes
next-routes copied to clipboard
add locale to url
Now I can write
routes
.add('index', '/:lang(ru|en)?', 'index')
.add('about', '/:lang(ru|en)?/about', 'about')
...
It is possible to release?
routes
.add('i18n', '/:lang(ru|en)?/:path?', ':path');
Im try to add custom handler but it work only on server
function customHandler(args) {
const {req, res, route, query} = args;
const path = query.path ? query.path : '';
app.render(req, res, `/${path}`, query);
}
Is the way to customize on client?
Not yet, but it’s a good idea! We could make the page parameter optionally accept a function, that receives the params and returns the page
I would love this funcitonality it looks exactly what I need
Any update on this?