March 2018
Beginner to intermediate
410 pages
10h 40m
English
To publish resources through our web server, we just call the Register method on the HttpServer object. We can choose between two methods: either we provide resource objects, inherited from the HttpResource class, such as the HttpSynchronousResource or HttpAsychronousResource classes, or we use lambda expressions or delegates for simple GET and POST resources.
We first demonstrate the latter to publish a resource for reading momentary sensor data. We provide a lambda expression, taking a request and response parameter. This expression will be executed when a GET method is received on the /Momentary resource:
this.httpServer.Register("/Momentary", (req, resp) =>
{
...
});
Read now
Unlock full access