From af4e74c39dc0dc59d2b68d63dcd20057975e88d8 Mon Sep 17 00:00:00 2001 From: mpl Date: Mon, 21 Nov 2022 17:30:06 +0100 Subject: [PATCH] doc: clarify PathPrefix greediness --- docs/content/routing/routers/index.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 3a5045a27..537e81ee1 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -276,10 +276,11 @@ The table below lists all the available matchers: !!! info "Path Vs PathPrefix" - Use `Path` if your service listens on the exact path only. For instance, `Path: /products` would match `/products` but not `/products/shoes`. + Use `Path` if your service listens on the exact path only. For instance, ```Path(`/products`)``` would match `/products` but not `/products/shoes`. Use a `*Prefix*` matcher if your service listens on a particular base path but also serves requests on sub-paths. - For instance, `PathPrefix: /products` would match `/products` but also `/products/shoes` and `/products/shirts`. + For instance, ```PathPrefix(`/products`)``` would match `/products` and `/products/shoes`, + as well as `/productsforsale`, and `/productsforsale/shoes`. Since the path is forwarded as-is, your service is expected to listen on `/products`. !!! info "ClientIP matcher"