Path for the users list

The USERS_PATH is a new pattern, which we didn't have in the previous example. We'll use it to return a full list of users on the server. This pattern fits only two variants of the path:

  • /users/  (with a trailing slash)
  • /users (without a trailing slash)

The regular expression to handle these cases is quite simple: "^/users/?$". We've already seen all the symbols in this pattern. It expects a string to begin with the ^ symbol and the slash symbol. After that, it expects users with an optional slash at the tail /?. Finally, it expects the end of a string with the $ symbol.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.191.86