Skip to content

Commit 00b3b72

Browse files
authored
fix: Remove obsolete Parse Server option pages.enableRouter (#10070)
1 parent 685af9e commit 00b3b72

File tree

7 files changed

+1
-39
lines changed

7 files changed

+1
-39
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ const api = new ParseServer({
388388
...otherOptions,
389389

390390
pages: {
391-
enableRouter: true,
392391
customRoutes: [{
393392
method: 'GET',
394393
path: 'custom_route',
@@ -425,7 +424,6 @@ The following paths are already used by Parse Server's built-in features and are
425424
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
426425
| ---------------------------- | -------- | --------------- | ------------- | --------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
427426
| `pages` | yes | `Object` | `undefined` | - | `PARSE_SERVER_PAGES` | The options for pages such as password reset and email verification. |
428-
| `pages.enableRouter` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_ROUTER` | Is `true` if the pages router should be enabled; this is required for any of the pages options to take effect. |
429427
| `pages.customRoutes` | yes | `Array` | `[]` | - | `PARSE_SERVER_PAGES_CUSTOM_ROUTES` | The custom routes. The routes are added in the order they are defined here, which has to be considered since requests traverse routes in an ordered manner. Custom routes are traversed after build-in routes such as password reset and email verification. |
430428
| `pages.customRoutes.method` | | `String` | - | `GET`, `POST` | - | The HTTP method of the custom route. |
431429
| `pages.customRoutes.path` | | `String` | - | `custom_page` | - | The path of the custom route. Note that the same path can used if the `method` is different, for example a path `custom_page` can have two routes, a `GET` and `POST` route, which will be invoked depending on the HTTP request method. |
@@ -582,7 +580,6 @@ const api = new ParseServer({
582580
...otherOptions,
583581
584582
pages: {
585-
enableRouter: true,
586583
enableLocalization: true,
587584
}
588585
}
@@ -635,7 +632,6 @@ const api = new ParseServer({
635632
...otherOptions,
636633
637634
pages: {
638-
enableRouter: true,
639635
enableLocalization: true,
640636
customUrls: {
641637
passwordReset: 'https://example.com/page.html'
@@ -697,7 +693,6 @@ const api = new ParseServer({
697693
...otherOptions,
698694

699695
pages: {
700-
enableRouter: true,
701696
enableLocalization: true,
702697
localizationJsonPath: './private/localization.json',
703698
localizationFallbackLocale: 'en'
@@ -725,7 +720,6 @@ const api = new ParseServer({
725720
...otherOptions,
726721

727722
pages: {
728-
enableRouter: true,
729723
placeholders: {
730724
exampleKey: 'exampleValue'
731725
}
@@ -740,7 +734,6 @@ const api = new ParseServer({
740734
...otherOptions,
741735

742736
pages: {
743-
enableRouter: true,
744737
placeholders: async (params) => {
745738
const value = await doSomething(params.locale);
746739
return {
@@ -760,7 +753,6 @@ The following parameter and placeholder keys are reserved because they are used
760753
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
761754
| ----------------------------------------------- | -------- | ------------------------------------- | -------------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
762755
| `pages` | yes | `Object` | `undefined` | - | `PARSE_SERVER_PAGES` | The options for pages such as password reset and email verification. |
763-
| `pages.enableRouter` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_ROUTER` | Is `true` if the pages router should be enabled; this is required for any of the pages options to take effect. |
764756
| `pages.enableLocalization` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_LOCALIZATION` | Is true if pages should be localized; this has no effect on custom page redirects. |
765757
| `pages.localizationJsonPath` | yes | `String` | `undefined` | `./private/translations.json` | `PARSE_SERVER_PAGES_LOCALIZATION_JSON_PATH` | The path to the JSON file for localization; the translations will be used to fill template placeholders according to the locale. |
766758
| `pages.localizationFallbackLocale` | yes | `String` | `en` | `en`, `en-GB`, `default` | `PARSE_SERVER_PAGES_LOCALIZATION_FALLBACK_LOCALE` | The fallback locale for localization if no matching translation is provided for the given locale. This is only relevant when providing translation resources via JSON file. |

spec/PagesRouter.spec.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('Pages Router', () => {
2424
appId: 'test',
2525
appName: 'exampleAppname',
2626
publicServerURL: 'http://localhost:8378/1',
27-
pages: { enableRouter: true },
27+
pages: {},
2828
};
2929
await reconfigureServer(config);
3030
});
@@ -66,7 +66,6 @@ describe('Pages Router', () => {
6666
it('responds with 404 if publicServerURL is not configured', async () => {
6767
await reconfigureServer({
6868
appName: 'unused',
69-
pages: { enableRouter: true },
7069
});
7170
const urls = [
7271
'http://localhost:8378/1/apps/test/verify_email',
@@ -99,7 +98,6 @@ describe('Pages Router', () => {
9998
await reconfigureServer({
10099
appName: 'exampleAppname',
101100
publicServerURL: 'http://localhost:8378/1',
102-
pages: { enableRouter: true },
103101
});
104102
});
105103

@@ -190,7 +188,6 @@ describe('Pages Router', () => {
190188
},
191189
publicServerURL: 'http://localhost:8378/1',
192190
pages: {
193-
enableRouter: true,
194191
enableLocalization: true,
195192
customUrls: {},
196193
},
@@ -207,9 +204,6 @@ describe('Pages Router', () => {
207204
describe('server options', () => {
208205
it('uses default configuration when none is set', async () => {
209206
await reconfigureServerWithPagesConfig({});
210-
expect(Config.get(Parse.applicationId).pages.enableRouter).toBe(
211-
Definitions.PagesOptions.enableRouter.default
212-
);
213207
expect(Config.get(Parse.applicationId).pages.enableLocalization).toBe(
214208
Definitions.PagesOptions.enableLocalization.default
215209
);
@@ -243,10 +237,6 @@ describe('Pages Router', () => {
243237
'a',
244238
0,
245239
true,
246-
{ enableRouter: 'a' },
247-
{ enableRouter: 0 },
248-
{ enableRouter: {} },
249-
{ enableRouter: [] },
250240
{ enableLocalization: 'a' },
251241
{ enableLocalization: 0 },
252242
{ enableLocalization: {} },
@@ -1192,7 +1182,6 @@ describe('Pages Router', () => {
11921182
verifyUserEmails: true,
11931183
emailAdapter,
11941184
publicServerURL: () => 'http://localhost:8378/1',
1195-
pages: { enableRouter: true },
11961185
});
11971186

11981187
const user = new Parse.User();
@@ -1222,7 +1211,6 @@ describe('Pages Router', () => {
12221211
verifyUserEmails: true,
12231212
emailAdapter,
12241213
publicServerURL: () => 'http://localhost:8378/1',
1225-
pages: { enableRouter: true },
12261214
});
12271215

12281216
const response = await request({
@@ -1245,7 +1233,6 @@ describe('Pages Router', () => {
12451233
appId: 'test',
12461234
appName: 'exampleAppname',
12471235
publicServerURL: 'http://localhost:8378/1',
1248-
pages: { enableRouter: true },
12491236
});
12501237

12511238
// Request the password reset page with an invalid token;
@@ -1270,7 +1257,6 @@ describe('Pages Router', () => {
12701257
appId: 'test',
12711258
appName: 'exampleAppname',
12721259
publicServerURL: 'http://localhost:8378/1',
1273-
pages: { enableRouter: true },
12741260
});
12751261
});
12761262

src/Config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,6 @@ export class Config {
293293
if (Object.prototype.toString.call(pages) !== '[object Object]') {
294294
throw 'Parse Server option pages must be an object.';
295295
}
296-
if (pages.enableRouter === undefined) {
297-
pages.enableRouter = PagesOptions.enableRouter.default;
298-
} else if (!isBoolean(pages.enableRouter)) {
299-
throw 'Parse Server option pages.enableRouter must be a boolean.';
300-
}
301296
if (pages.enableLocalization === undefined) {
302297
pages.enableLocalization = PagesOptions.enableLocalization.default;
303298
} else if (!isBoolean(pages.enableLocalization)) {

src/Options/Definitions.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,6 @@ module.exports.PagesOptions = {
688688
action: parsers.booleanParser,
689689
default: false,
690690
},
691-
enableRouter: {
692-
env: 'PARSE_SERVER_PAGES_ENABLE_ROUTER',
693-
help: 'Is true if the pages router should be enabled; this is required for any of the pages options to take effect.',
694-
action: parsers.booleanParser,
695-
default: false,
696-
},
697691
forceRedirect: {
698692
env: 'PARSE_SERVER_PAGES_FORCE_REDIRECT',
699693
help: 'Is true if responses should always be redirects and never content, false if the response type should depend on the request type (GET request -> content response; POST request -> redirect response).',

src/Options/docs.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ export interface SecurityOptions {
420420
}
421421

422422
export interface PagesOptions {
423-
/* Is true if the pages router should be enabled; this is required for any of the pages options to take effect.
424-
:DEFAULT: false */
425-
enableRouter: ?boolean;
426423
/* Is true if pages should be localized; this has no effect on custom page redirects.
427424
:DEFAULT: false */
428425
enableLocalization: ?boolean;

types/Options/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ export interface SecurityOptions {
156156
checkGroups?: (CheckGroup[]);
157157
}
158158
export interface PagesOptions {
159-
enableRouter?: boolean;
160159
enableLocalization?: boolean;
161160
localizationJsonPath?: string;
162161
localizationFallbackLocale?: string;

0 commit comments

Comments
 (0)