Skip to content

Comments

fix: Remove ** from StaticRoute.directory() path examples#429

Merged
nielsenko merged 2 commits intomainfrom
copilot/update-staticroute-docs
Feb 20, 2026
Merged

fix: Remove ** from StaticRoute.directory() path examples#429
nielsenko merged 2 commits intomainfrom
copilot/update-staticroute-docs

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

StaticRoute.directory() now automatically appends tail matching via tailMatch, so manually including ** in the path is incorrect. The docs were still showing the old pattern.

Changes

  • 01-overview.md — Remove ** from two StaticRoute.directory() path examples
  • 05-static-files.md — Remove ** from three path examples; update info box from "required" to "automatically handled"
  • 02-routing.md — Remove ** from virtual-host StaticRoute.directory() example
  • 08-upgrading/01-upgrade-to-three.md — Remove ** from the "After" examples (old RouteStaticDirectory "Before" examples unchanged)

Before / After

// Before (incorrect)
pod.webServer.addRoute(StaticRoute.directory(Directory('web/static')), '/static/**');

// After (correct)
pod.webServer.addRoute(StaticRoute.directory(Directory('web/static')), '/static/');
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix stale documentation for StaticRoute.directory() usage</issue_title>
<issue_description>## Description

The documentation for StaticRoute.directory() is stale and needs to be updated to reflect recent changes in how tail-matching is handled.

Issue

Users are currently instructed to add the ** pattern themselves when setting up static routes, but this is now handled automatically by the StaticRoute._ constructor via the tailMatch parameter.

What needs to be fixed

Update the documentation to show that users should not include ** in the path when calling StaticRoute.directory().

Current (incorrect) documentation suggests:

server.webServer.addRoute(
  StaticRoute.directory(Directory('web/files')),
  'files/**', // <-- don't add ** manually
);

Correct usage:

server.webServer.addRoute(
  StaticRoute.directory(Directory('web/files')),
  'files/', // <-- no **
);

The ** pattern is now automatically set up in:

StaticRoute._(this._handler, {required bool tailMatch})
    : super(methods: {Method.get, Method.head}, path: tailMatch ? '/**' : '/');

Related

Comments on the Issue (you are @copilot in this section)

@nielsenko This should be moved to serverpod_docs repo

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: nielsenko <22237677+nielsenko@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix stale documentation for StaticRoute.directory() usage Fix stale docs: remove ** from StaticRoute.directory() path examples Feb 20, 2026
Copilot AI requested a review from nielsenko February 20, 2026 10:55
@nielsenko nielsenko changed the title Fix stale docs: remove ** from StaticRoute.directory() path examples fix: Remove ** from StaticRoute.directory() path examples Feb 20, 2026
@nielsenko nielsenko marked this pull request as ready for review February 20, 2026 11:34
@nielsenko nielsenko merged commit 2c485cf into main Feb 20, 2026
3 of 6 checks passed
@nielsenko nielsenko deleted the copilot/update-staticroute-docs branch February 20, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix stale documentation for StaticRoute.directory() usage

3 participants