Add custom routes to pages router (#7231)

* added custom routes

* fixed docs typos

* added page.customRoutes config validation

* added 404 response if missing custom route response

* added docs

* minor README formatting

* added CHANGELOG entry

* fixed bug in definitions builder that did not recognize array of custom type

* added missing route handler definition

* fixed custom routes definition
This commit is contained in:
Manuel
2021-03-07 13:51:35 +01:00
committed by GitHub
parent cac6951be0
commit de50b7b23d
10 changed files with 327 additions and 17 deletions

View File

@@ -82,6 +82,7 @@
/**
* @interface PagesOptions
* @property {PagesRoute[]} customRoutes The custom routes.
* @property {PagesCustomUrlsOptions} customUrls The URLs to the custom pages.
* @property {Boolean} enableLocalization Is true if pages should be localized; this has no effect on custom page redirects.
* @property {Boolean} enableRouter Is true if the pages router should be enabled; this is required for any of the pages options to take effect. Caution, this is an experimental feature that may not be appropriate for production.
@@ -93,6 +94,13 @@
* @property {Object} placeholders The placeholder keys and values which will be filled in pages; this can be a simple object or a callback function.
*/
/**
* @interface PagesRoute
* @property {Function} handler The route handler that is an async function.
* @property {String} method The route method, e.g. 'GET' or 'POST'.
* @property {String} path The route path.
*/
/**
* @interface PagesCustomUrlsOptions
* @property {String} emailVerificationLinkExpired The URL to the custom page for email verification -> link expired.