O'Reilly logo

Getting Started with the Internet of Things by Cuno Pfister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Request Handlers

The web server’s RequestRouting property is used to specify which request handler will handle which request pattern (request methods such as GET, request URIs such as /hello).

For example, the pair:

{ "GET /hello", HandleGetHello }

declares that when a GET request with the request URI /hello has been received, the method HandleGetHello should be called for handling this request.

The request pattern string, e.g., "GET /hello", first gives the HTTP method that is accepted—in this case, GET. This is followed by a blank, which is followed by the request URI: a relative URI that starts with a / character. If your request handler can support several HTTP methods, you can pass the * character instead of an HTTP method name, e.g., "* /led/target" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required