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:
@@ -256,6 +256,18 @@ export interface PagesOptions {
|
||||
/* The URLs to the custom pages.
|
||||
:DEFAULT: {} */
|
||||
customUrls: ?PagesCustomUrlsOptions;
|
||||
/* The custom routes.
|
||||
:DEFAULT: [] */
|
||||
customRoutes: ?(PagesRoute[]);
|
||||
}
|
||||
|
||||
export interface PagesRoute {
|
||||
/* The route path. */
|
||||
path: string;
|
||||
/* The route method, e.g. 'GET' or 'POST'. */
|
||||
method: string;
|
||||
/* The route handler that is an async function. */
|
||||
handler: () => void;
|
||||
}
|
||||
|
||||
export interface PagesCustomUrlsOptions {
|
||||
|
||||
Reference in New Issue
Block a user