Plugging in our existing views
When it comes to our views, they are also isolated, and we can copy our views over to the Rocket application with a few minor changes to recycle the views that we built for our Actix Web application. We can copy the views with the following command:
cp -r web_app/src/views rocket_app/src/views
With this copy, it goes without saying now that we must go through and scrub the views of any mentions of the Actix Web framework, as we are not using it. Once we have cleaned our views of any mention of Actix Web, we can refactor our existing code so that it works with the Rocket framework. We will start with our login
view, as this takes in a JSON body and returns JSON in the following subsection.
Accepting and returning JSON
Before we change our view, we need to make sure that we have imported all we need in the src/views/auth/login.rs
file with the following code:
use crate::diesel; use diesel::prelude::*; use rocket::serde::json::Json; use crate...