Skip to content

Support URL for root parameter (and file: protocol) #364

@saschanaz

Description

@saschanaz

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

For now it must be string or array of strings, but modern Node.js also supports URL for many APIs. It would be great to support it here too.

Motivation

root: new URL(".", import.meta.url) (or .toString()) fails because neither of URL nor file: protocol is supported. fileURLToPath is always required.

Example

fastify.register(fastifyStatic, {
  root: new URL("assets/", import.meta.url)
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerssemver-minorIssue or PR that should land as semver minor

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions