Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐣 Feature Spotlight: Pages Router #7259

Closed
mtrezza opened this issue Mar 11, 2021 · 0 comments
Closed

🐣 Feature Spotlight: Pages Router #7259

mtrezza opened this issue Mar 11, 2021 · 0 comments
Labels
type:meta Non-code issue

Comments

@mtrezza
Copy link
Member

mtrezza commented Mar 11, 2021

Pages Router

The PagesRouter is a completely revamped router with many improvements over the current PublicAPIRouter. It handles requests for password reset and email verification, and serves assets in the /public directory such as webpages. It is an experimental replacement for the PublicAPIRouter, so it is still disabled by default.

Features

  • Inject dynamic content into any HTML site that could previously only be served as static asset.
  • Localization of feature pages (password reset, email verification) and custom pages (any HTML page).
  • Fully localized flow (email -> pages) for users in combination with the Parse Server API Mail Adapter.
  • Easily add custom routes to customize the password reset or email verification flow or add new flows.
  • Reduces network traffic by directly serving webpages instead of redirects.
  • Customize the endpoint path and public directory.

Usage

Caution, this is an experimental feature that may not be appropriate for production.

To enable the PagesRouter set the Parse Server configuration pages.enableRouter: true. Set the other options if you want to use features such as localization.

 new ParseServer({
   ...,
   pages: {
     enableRouter: true, // Enables the PageRouter by replacing the PublicAPIRouter; this is the general switch to turn on the experimental feature; default: false
     enableLocalization: true, // Enables looking for locale matching page version on request; default: false
     localizationJsonPath: './private/localization.json', // The path to the JSON file for localization; the translations will be used to fill template placeholders according to the locale.
     localizationFallbackLocale: 'en', // 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.
     placeholders: { aKey: 'aValue' }, // The placeholder keys and values which will be filled in pages; this can be a simple object or a callback function.
     forceRedirect: false, // Enables always sending redirect responses and never sending content directly; default: false
     pagesPath: './pages/', // A custom path to the page files; also sets where the '/apps' endpoint points to; default: './public'.
     pagesEndpoint: 'pages', // A custom endpoint to the pages; also sets the '/apps' endpoint for password reset and email verification; default: 'apps'.
   }
 })

Factsheet

About

  • This issue is only intended to inform. If you encounter a bug or have a suggestion please open a new issue.
  • This is a pilot for a new series in which we move different notable feature addition or improvement into the spotlight.
  • Got feedback regarding this series? - Post in the Community Forum.
@mtrezza mtrezza pinned this issue Mar 11, 2021
@parse-community parse-community locked as resolved and limited conversation to collaborators Mar 11, 2021
@mtrezza mtrezza closed this as completed Mar 11, 2021
@parse-community parse-community unlocked this conversation Mar 11, 2021
@parse-community parse-community locked and limited conversation to collaborators Mar 11, 2021
@mtrezza mtrezza added the type:meta Non-code issue label Mar 11, 2021
@parse-community parse-community unlocked this conversation Mar 11, 2021
@mtrezza mtrezza unpinned this issue Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:meta Non-code issue
Projects
None yet
Development

No branches or pull requests

1 participant