January 2019
Intermediate to advanced
520 pages
14h 32m
English
The Router microservice uses the /signup route to resend a signup request to a users microservice bound to the 127.0.0.1:8001 address. This request creates a new users with filled from UserForm, passed with a parameter wrapped with the Form type. Look at the following code:
fn signup(params: Form<UserForm>) -> FutureResponse<HttpResponse> { let fut = post_request("http://127.0.0.1:8001/signup", params.into_inner()) .map(|_: ()| { HttpResponse::Found() .header(header::LOCATION, "/login.html") .finish() }); Box::new(fut)}
We call the post_request function that we declared before to send a POST request to a users microservice and if it returns a successful response, we return a response with a 302 status code. We create HttpResponseBuilder ...
Read now
Unlock full access