I am trying to serve static files via top level public_html folder included along with my parse server, but my files are ignored.
Looking at the https://github.com/parse-community/parse-server/blob/5d8408507135239629312ae1135855e04e285289/src/Routers/PublicAPIRouter.js#L9 and https://github.com/parse-community/parse-server/blob/5d8408507135239629312ae1135855e04e285289/src/Routers/PublicAPIRouter.js#L318 where the public_html static route is defined, the static files from public_html dir should be available under http://server:1337/parse/apps/ URL.
Debugging this actually revealed that https://github.com/parse-community/parse-server/blob/5d8408507135239629312ae1135855e04e285289/src/Routers/PublicAPIRouter.js#L9 actually expands the public_html directory path to node_modules/parse-server/public_html and therefore serves the files shipped with the current version of the parse-server, not my files shipped along.
The same problem applies with the views directory.
Path to public_html and views should either be configurable the same way path the cloud code is using the cloud option here: https://github.com/parse-community/parse-server/blob/7f47b0427ea56214d9b0199f0fcfa4af38794e02/src/Options/index.js#L70 or it should first try to lookup dir shipped alongside parse-server and only then fallback to node_modules/parse-server/public_html
Looks like some work has already progressed along these lines to deprecate the use of public_html and views in favor of the new PagesRouter so feel free to close this as will not fix. Filing for future developers that may be hit.
Server
Thanks for reporting.
This is expected - although not optimal - behavior when running Parse Server as a module. Feel free to provide a PR to fix this, ideally via a path parameter in the Parse Server options.
Alternatively feel free to enable the PagesRouter that allows you to specify the path and other options. The router is still experimental and is not officially released for use in production critical environments. I will say though that it has been tested extensively and is currently being used in production environments, just so you get a better sense of its maturity.
I have classified this as bug with severity S3:
PagesRouter or fork Parse Server and override path to public directory in PublicAPIRouter.js.Thank @mtrezza for classifying this. I will very probably go with the PagesRouter but wanted to have this documented.
Sure, please provide any feedback including possible optimizations for the PagesRouter.
The PagesRouter is currently in the docs under "Localization", that being its major feature, but it has other, localization-unrelated improvements as you can find in the related PR.
I am closing this as won't fix as the PagesRouter already provides a fix for this, albeit still in experimental status. Feel free to comment if you have any questions and we can re-open.