A route connects request properties to a web-application handler. In practice, an HTTP method and path such as GET and /device/status select the behavior that produces the response. section 13.2.3
Giraffe treats route matching as an HTTP handler that can be composed with method filters and response handlers. This replaces manual branching with a short, uniform pipeline. section 13.2.3 section 13.2.4
A status endpoint
GET >=> route "/device/status" >=> text "device is operating correctly" composes a method check, path match, and text response. Visiting the endpoint returns the expected status message. section 13.2.3
Compose several routes with choose when an application exposes multiple endpoints:
- GET >=> route "/device/status" handles status requests. section 13.2.4
- POST >=> route "/device/execute" handles command requests. section 13.2.4
- choose tries handlers in order and returns the first successful match. section 13.2.4
GET >=> route "/device/status" >=> text "device is operating correctly"
Inspect the compact Giraffe pipeline combining an HTTP method, route, and response handler. section 13.2.3
