January 2019
Intermediate to advanced
520 pages
14h 32m
English
Create a router.rs file and add the following modules and types:
mod types;mod utils;use self::utils::{Method, StatusCode, WebApi};use self::types::Comment;
Since the router microservice also serves static files by the root path that we used for the other microservice, to check that they are alive, we will use a special /healthcheck path that returns the name of that microservice:
#[test]fn router_healthcheck() { let mut api = WebApi::router(); api.healthcheck("/healthcheck", "Router Microservice");}
The complete test is implemented in the check_router_full test. Look at the following code:
#[test]fn check_router_full() { let mut api = WebApi::router(); let username = utils::rand_str() + "@example.com"; let password = utils::rand_str(); ...Read now
Unlock full access