Add custom routes to pages router#7231
Conversation
* commit 'ccb045b68c5b4d983a90fa125513fc476e4e2387': fix: upgrade @graphql-tools/links from 6.2.4 to 6.2.5 (parse-community#7007) fix: upgrade pg-promise from 10.7.0 to 10.7.1 (parse-community#7009) fix: upgrade jwks-rsa from 1.10.1 to 1.11.0 (parse-community#7008) fix: upgrade graphql from 15.3.0 to 15.4.0 (parse-community#7011) update stale bot (parse-community#6998) fix(beforeSave/afterSave): Return value instead of Parse.Op for nested fields (parse-community#7005) fix(beforeSave): Skip Sanitizing Database results (parse-community#7003) Fix includeAll for querying a Pointer and Pointer array (parse-community#7002) Init (parse-community#6999)
* commit '7f47b0427ea56214d9b0199f0fcfa4af38794e02': Add page localization (parse-community#7128) Improve contribution guide (parse-community#7075) fix: upgrade pg-promise from 10.9.0 to 10.9.1 (parse-community#7170) Add tests against multiple MongoDB versions (parse-community#7161) fix: upgrade mime from 2.4.7 to 2.5.0 (parse-community#7166) fix: upgrade pg-promise from 10.8.7 to 10.9.0 (parse-community#7168) fix: upgrade apollo-server-express from 2.19.1 to 2.19.2 (parse-community#7165) Upgrade @node-rs/bcrypt to latest version (parse-community#7159) Run Prettier after Definitions (parse-community#7164)
Codecov Report
@@ Coverage Diff @@
## master #7231 +/- ##
==========================================
+ Coverage 94.00% 94.03% +0.03%
==========================================
Files 172 172
Lines 12955 12970 +15
==========================================
+ Hits 12178 12196 +18
+ Misses 777 774 -3
Continue to review full report at Codecov.
|
|
This is ready for review; a good place to get familiar with this feature is to read the added docs in the README. |
|
@mtrezza thanks for the PR! I'd like to better understand the problem that this feature solves. What would be the benefit of using the custom route instead of just mounting a new endpoint in the Express.js app? |
|
@davimacedo Sure, this is mostly a forward-looking PR, because it provides the basis to make future features available to all custom routes by just adding a feature to the PagesRouter. But there are already some benefits in this first version:
|
davimacedo
left a comment
There was a problem hiding this comment.
I am in for this new feature in Parse Server. @dplewis thoughts?
dplewis
left a comment
There was a problem hiding this comment.
Looks good! Just a quick comment.
|
@dplewis Thanks, this is ready for review |
|
If there is no objection, I'll merge this later today; this also fixes an issue with the config definitions builder (described above) which I again stumble upon in another PR. |
|
🎉 This change has been released in version 5.0.0-beta.1 |
|
🎉 This change has been released in version 5.0.0 |
New Pull Request Checklist
Issue Description
Currently, the experimental
PagesRouterdoes not allow to add custom routes.Related issue: closes #7230
Approach
Add Parse Server option
pages.customRoutesto define custom routes that are then auto-mounted by thePagesRouter.Example:
The above route can be invoked by requesting
https://example.com/[mount]/apps/[appId]/custom_page.The returned file enjoys all the internal logic that is also used by the feature pages (e.g password reset) such as localization, and custom placeholders.
Note: This feature is only implemented in the still experimental
PagesRouterwhich is expected to deprecate thePublicAPIRouterin the future.Side effects
TODOs before merging