Skip to content

parse-server ignoring my public_html folder for static files, serves files shipped with parse-server #7204

Closed
@mman

Description

@mman

New Issue Checklist

Issue Description

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

const public_html = path.resolve(__dirname, '../../public_html');
and
router.use('/apps', express.static(public_html));
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

const public_html = path.resolve(__dirname, '../../public_html');
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.

Suggested Fix

Path to public_html and views should either be configurable the same way path the cloud code is using the cloud option here:

cloud: ?string;
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.

Environment

Server

  • Parse Server version: 4.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:wont-fixWon’t be fixed with a clearly stated reasontype:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions