Hands-On Microservices with Rust by Denis Kolodin

Hands-On Microservices with Rust by Denis Kolodin

Author:Denis Kolodin
Language: eng
Format: epub
Tags: COM051070 - COMPUTERS / Programming Languages / C++, COM048000 - COMPUTERS / Systems Architecture / Distributed Systems and Computing, COM060160 - COMPUTERS / Web / Web Programming
Publisher: Packt Publishing
Published: 2019-01-31T23:05:42+00:00


Handling requests

The Rouille framework contains a router! macro that helps you declare a handler for every path and HTTP method. If we add a handler function that is called from a closure we used in the start_server function call, the router! macro expects a request instance as the first argument and the desired number of request handlers. Let's analyze the four handler functions in order.

Root handler

The following is a simple handler that expects a GET method and returns a text response:

(GET) (/) => {

Response::text("Users Microservice")

},



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.