Skip to content

docs: document removed options for res.sendFile() and express.static() in Express 5 migration guide - #2211

Merged
bjohansebas merged 7 commits into
expressjs:redesignfrom
chakri11-git:gh-pages
Apr 4, 2026
Merged

docs: document removed options for res.sendFile() and express.static() in Express 5 migration guide#2211
bjohansebas merged 7 commits into
expressjs:redesignfrom
chakri11-git:gh-pages

Conversation

@chakri11-git

Copy link
Copy Markdown
Contributor

Description

Fixes#1868

Changes made

en/guide/migrating-5.md

  • Added new section documenting removed options for res.sendFile()
    and express.static():
    • hidden → use dotfiles option instead
    • from → use root option instead
  • Added TOC entry linking to the new section

Motivation

Developers upgrading from Express 4 to Express 5 who used the hidden
or from options in res.sendFile() or express.static() would
encounter silent breakage with no guidance in the migration guide.
This PR documents those removed options so users know what to replace
them with.

Note

Previous PR #2209 was closed due to including internal send package
methods that were not part of the public Express API. This PR contains
only the user-facing option changes.

@chakri11-git
chakri11-git requested a review from a team as a code ownerMarch 18, 2026 16:16
@netlify

netlifyBot commented Mar 18, 2026

Copy link
Copy Markdown

Deploy Preview for expressjscom-preview ready!

NameLink
🔨 Latest commitb29e7f6
🔍 Latest deploy loghttps://app.netlify.com/projects/expressjscom-preview/deploys/69d08f500031760008e5293a
😎 Deploy Previewhttps://deploy-preview-2211--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🟢 up 3 from production)
Accessibility: 100 (🟢 up 13 from production)
Best Practices: 100 (no change from production)
SEO: 100 (🟢 up 6 from production)
PWA: 80 (🟢 up 50 from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@krzysdzkrzysdz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be also mentioned for res.sendFile() that the default for dotfiles changed to "ignore". I think it could be merged with the "express.static dotfiles" section.

There's also the switch to mime-types (pillarjs/send#192), which affects res.sendFile() and express.static, but is mentioned (twice) in sections about res.sendfile() (lowercase f) and express.static.mime, so there's a (small) chance someone could miss it when looking only at the ToC. I'm not sure if this is something that really needs changing, but I'll leave it here for reviewers to decide.

By the way you don't have to close a PR and open a new one after pushing new commits. You could have kept #2209 and it would show the new changes automatically after updating source branch.

@bjohansebas

Copy link
Copy Markdown
Member

Aside from @krzysdz’s comments, this needs to be released for the new documentation. Since I don’t have time to do documentation backports, could you update the reference to the new redesign branch in this same PR? Otherwise, I’ll do it when I start modifying the documentation.

@chakri11-git

Copy link
Copy Markdown
ContributorAuthor

Hi! I've addressed all the feedback:

  • Removed the internal send.* methods section
  • Combined res.sendFile() and express.static() dotfiles
    into a single section, explicitly mentioning the new default
    value of "ignore"
  • Consolidated the duplicate MIME type documentation from
    res.sendfile() and express.static.mime sections into one
    dedicated section with updated TOC entry
  • Updated _includes/github-edit-btn.html to point to the
    redesign branch as requested

Please let me know if any further changes are needed. Thank you!

Comment threaden/guide/migrating-5.md Outdated
- HTML files (.html): now "text/html; charset=utf-8" instead of just "text/html"
- XML files (.xml): now "application/xml" instead of "text/xml"
- Font files (.woff): now "font/woff" instead of "application/font-woff"
- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this really change? I looked at mime@1.6.0 types database and I see image/svg+xml as the type for .svg and .svgz extensions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I see that the duplicate sections weren't identical and one of them mentioned SVG. It turns out #1903 was vibecoded and is AI slop. Almost everything in this section is incorrect. Of all listed extensions only one has a different mime type - .js changed from application/javascript to text/javascript. HTML, CSS, JS and JSON also always had charset specified in Content-Type, so this didn't change either.

Comment thread_includes/github-edit-btn.html Outdated
Comment on lines +3 to +5
{{ site.github.repository_url }}/tree/redesign/_includes/api/en/{{page.version}}
{% else %}
{{ site.github.repository_url }}/edit/gh-pages/{{ page.path }}
{{ site.github.repository_url }}/edit/redesign/{{ page.path }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @bjohansebas meant changing the PR base branch to redesign, not changing the edit button URL.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review!

  1. PR base branch — I have changed the base branch of this PR
    from gh-pages to redesign as requested.

  2. SVG MIME type — After checking the Express 4 source code,
    application/svg+xml was indeed the type used in Express 4,
    so the change to image/svg+xml in Express 5 is accurate and
    I have kept it in the documentation.

  3. Edit button — Reverted _includes/github-edit-btn.html
    back to gh-pages since the redesign branch is now the base
    of the PR itself.

Please let me know if any further changes are needed. Thank you!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that’s what I meant.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done those changes

@krzysdzkrzysdzMar 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. PR base branch — I have changed the base branch of this PR
    from gh-pages to redesign as requested.

You did not, but @bjohansebas did that for you 30 min ago. You'll need to rebase your branch on redesign (git rebase redesign).

  1. SVG MIME type — After checking the Express 4 source code,
    application/svg+xml was indeed the type used in Express 4,
    so the change to image/svg+xml in Express 5 is accurate and
    I have kept it in the documentation.

Please don't blindly trust LLMs. This is not something done by Express directly, but mime (Express 4) or mime-types (and mime-db) (Express 5). I sent you a direct link to the mime type and file extension mapping from mime@1.6.0, where you can find what type is used for .svg in Express 4. You could also run a simple server to verify that Express 4 did not use application/svg+xml, but something else.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback and sorry for the incorrect SVG claim.
I verified using mime@1.6.0 directly:

node -e "const mime = require('mime'); console.log(mime.lookup('svg'));"
// output: image/svg+xml

This confirms SVG already returned "image/svg+xml" in Express 4 so
it was not a change. I have removed that line.

I have also rebased the branch on upstream/redesign — the PR now
shows 1 file changed with only the relevant changes to
legacy/en/guide/migrating-5.md.

Sorry for the confusion earlier and thank you for your patience!

@bjohansebas

Copy link
Copy Markdown
Member

Note that I haven’t reviewed what this PR does, and I won’t do so until next weekend when I go on vacation to take the final steps of the redesign

@bjohansebas
bjohansebas changed the base branch from gh-pages to redesignMarch 22, 2026 21:53
@bjohansebas

Copy link
Copy Markdown
Member

@22BRS1317 now do the rebase

@bjohansebas
bjohansebas merged commit e75a587 into expressjs:redesignApr 4, 2026
9 of 10 checks passed
@bjohansebasbjohansebas mentioned this pull request Apr 4, 2026
Sign up for freeto 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.

Add the changes in send to the migration guide

3 participants

@chakri11-git@bjohansebas@krzysdz