Skip to content
Playground(another site)

bynk.http.duplicate_route

Error Two handlers share the same method and route.

A route is a method and a path, and the router needs exactly one handler to answer it. Two handlers that declare the same pair, in one service or in two services of a context, leave it nothing to choose between, so the later one is refused. Merge them, or give one a different path or method.

Example

on GET("/items") () -> Effect[HttpResult[String]] by v: Visitor { … }
on GET("/items") () -> Effect[HttpResult[String]] by v: Visitor { … } // ✗ already declared above
on GET("/items/:id") (id: String) -> Effect[HttpResult[String]] by v: Visitor { … } // ✓ a different path

In the Book

See also

  • The grammar rule it governs: http_handler.
  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.duplicate_route shows the same from the installed toolchain, without a network.