Wildcard routing

Let's say you want to catch all paths that end under hello. This is easy to do with the wildcard character in your path. For example, the following route will get called any time someone requests it:

  • /welcome
  • /welcome/to/vapor/
  • /welcome/to/vapor/and/swift
drop.get("welcome", "*") { req in  return "Welcome"}

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.