Skip to content

Fix regular expressions in server.js#1

Open
marcosvcg wants to merge 1 commit intogitdagray:mainfrom
marcosvcg:patch-1
Open

Fix regular expressions in server.js#1
marcosvcg wants to merge 1 commit intogitdagray:mainfrom
marcosvcg:patch-1

Conversation

@marcosvcg
Copy link
Copy Markdown

@marcosvcg marcosvcg commented Aug 11, 2025

The Express v5 release update no longer supports “sub-expression” regular expressions. This release includes simplified patterns for common route patterns. With the removal of regular expression semantics comes other small but impactful changes to how you write your routes.

  1. :name? becomes {:name}. Usage of {} for optional parts of your route means you can now do things like /base{/:optional}/:required and what parts are actually optional is much more explicit.

  2. '*' becomes '*name'.

Oficial documentation:
https://expressjs.com/2024/10/15/v5-release.html

The Express v5 release update no longer supports “sub-expression” regular expressions. This release includes simplified patterns for common route patterns. With the removal of regular expression semantics comes other small but impactful changes to how you write your routes.

1. :name? becomes {:name}. Usage of {} for optional parts of your route means you can now do things like /base{/:optional}/:required and what parts are actually optional is much more explicit.

2. * becomes *name.

Oficial documentation:
https://expressjs.com/2024/10/15/v5-release.html
@marcosvcg
Copy link
Copy Markdown
Author

This works only for Express version 5.0.0 or higher, the actual "package.json" file will need a change too if this commit is merged!

image

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.

2 participants