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:
@@ -425,6 +425,12 @@ module.exports.ParseServerOptions = {
|
||||
},
|
||||
};
|
||||
module.exports.PagesOptions = {
|
||||
customRoutes: {
|
||||
env: 'PARSE_SERVER_PAGES_CUSTOM_ROUTES',
|
||||
help: 'The custom routes.',
|
||||
action: parsers.arrayParser,
|
||||
default: [],
|
||||
},
|
||||
customUrls: {
|
||||
env: 'PARSE_SERVER_PAGES_CUSTOM_URLS',
|
||||
help: 'The URLs to the custom pages.',
|
||||
@@ -481,6 +487,23 @@ module.exports.PagesOptions = {
|
||||
default: {},
|
||||
},
|
||||
};
|
||||
module.exports.PagesRoute = {
|
||||
handler: {
|
||||
env: 'PARSE_SERVER_PAGES_ROUTE_HANDLER',
|
||||
help: 'The route handler that is an async function.',
|
||||
required: true,
|
||||
},
|
||||
method: {
|
||||
env: 'PARSE_SERVER_PAGES_ROUTE_METHOD',
|
||||
help: "The route method, e.g. 'GET' or 'POST'.",
|
||||
required: true,
|
||||
},
|
||||
path: {
|
||||
env: 'PARSE_SERVER_PAGES_ROUTE_PATH',
|
||||
help: 'The route path.',
|
||||
required: true,
|
||||
},
|
||||
};
|
||||
module.exports.PagesCustomUrlsOptions = {
|
||||
emailVerificationLinkExpired: {
|
||||
env: 'PARSE_SERVER_PAGES_CUSTOM_URL_EMAIL_VERIFICATION_LINK_EXPIRED',
|
||||
|
||||
Reference in New Issue
Block a user