January 2019
Intermediate to advanced
520 pages
14h 32m
English
To discuss these more advanced topics, we need a microservices architecture that has a more useful purpose than generating hello messages. We will create a microservice application for generating random values. This is simple enough to implement and will provide us with sufficient opportunities to use logging and configuration.
However, we won't start completely from scratch; let's take the example from the previous chapter and add a dependency to it:
[dependencies]hyper = "0.12"rand = "0.5"
A rand crate provides the utilities necessary to generate random values in Rust. Import the necessary types in the main.rs file:
use hyper::{Body, Response, Server};use hyper::rt::Future;use hyper::service::service_fn_ok; ...Read now
Unlock full access