In the preceding example, we used pattern matching to detect the destination of a request. This isn't a flexible technique, because the path often contains extra characters that have to be taken into account. The /user/1/ path, for example, contains the trailing slash, / , which can't be parsed with a user ID in the previous version of our microservice. There's a flexible tool to fix this issue: regular expressions.
Routing advanced requests
Defining paths with regular expressions
A regular expression is a sequence of characters that express a pattern to be searched for in a string. Regular expressions provide you with the ability to create tiny parsers that split a text into parts using...