createRouter(app, [options])
Creates locale aware express router with universal cookie and gzip compression enabled.
Gzip compression is only enabled on production environment
Arguments
app
(Next Server)[
options
] (Object):[
routes
] (Object.<Object>): An object which key is a route path and value is an object with the following properties:page
(String): Path to page component.[
method
] (String): HTTP method, default isGET
.
[
redirects
] (Object.<Object>): An object which key is a redirection source path and value is an object with the following properties:to
(String): Redirection target path.[
method
] (String): HTTP method, default isGET
.[
status
] (Number): HTTP status code for redirection, default is301
.
[
compression
] (Object): See here for compression options.[
defaultLocale
] (String): A locale string used as fallback locale, e.g.id-id
,en-id
, etc.[
siteLocales
] (Array.<String>): An array of locale string supported by your app.
Returns
(Express.Router): An object of express router.
Examples
Basic Usage
Options
compression
compression
defaultLocale
and siteLocales
defaultLocale
and siteLocales
redirects
redirects
routes
routes
Last updated