Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scandipwa/route717
https://github.com/scandipwa/route717
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/scandipwa/route717
- Owner: scandipwa
- License: osl-3.0
- Created: 2019-03-26T08:16:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-04T09:17:35.000Z (8 months ago)
- Last Synced: 2024-09-19T21:10:45.628Z (2 months ago)
- Language: PHP
- Size: 90.8 KB
- Stars: 2
- Watchers: 4
- Forks: 20
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScandiPWA Route717
Module is providing custom router to properly resolve HTTP codes on specific page request.
## v1.1.0 update
Custom router is now checking theme type in order to support URL rewrites.
You must ensure PWA theme type is set to `4` to utilize the options.[Installer](https://github.com/scandipwa/installer) is doing this automatically for any newly generated theme.
For already generated theme please update manually: set PWA theme type to `4` in `theme` table.
## Installation
```composer require scandipwa/route717```## Description
Module is providing validators for such entities:
1) Product (/product)
2) Category (/category)
3) Cms pages (/page)
4) Cart (/cart)
5) Root (/)## How it works
Each frontend path (Magento 2 front name) should be added to validator list in `src/etc/di.xml`. Depending on entity
type it might have more or less complex validation logic, to i.e. determine if specific product exists or not.
Router is only responding 200 OK to entities, which it was able to validate. Otherwise it is falling back to default
Magento 2 routers.## Customization
To add new path you must provide your own validator, that must implement `ScandiPWA\Router\ValidatorInterface` and
register it as an array element passed to `ScandiPWA\Router\ValidationManager` using `di.xml`.## Accessing Magento 2 default routes
In order to allow Magento 2 to handle some routes in default manner (only serverside functionality) you must allow
specific routes to be accessed by adding RegExp to `src/app/etc/di.xml::ignoredURLs` arguments list.
So far there are 3 paths whitelisted out of the box:
- `/newsletter/subscriber/confirm` - subscribe to newsletter
- `/newsletter/subscriber/unsubscribe` - unsubscribe to newsletter
- `/customer/account/confirm/` - confirm e-mail (redirect to homepage in any case, modify according to your needs)