Connecting backend API endpoints to the frontend
We are going to connect our frontend to our backend server via HTTP requests. This means that we must connect our to-do nanoservice to our ingress. Before we can do this we must add the following decencies to our ingress Cargo.toml
file with the following code:
# File: ingress/Cargo.toml
[dependencies]
. . .
actix-cors = "0.7.0"
to_do_server = {
path = "../nanoservices/to_do/networking/actix_server",
package = "actix_server"
}
We are going to use actix-cors
to enable requests from other locations. Right now, this will not be an issue as our frontend will be making requests from the localhost on the same computer at the server. However, when we deploy our application, the React application will be running on a user's computer and their requests will come from their computer, not the same computer that our server is running on. We have also been compiling our to-do nanoservice into our ingress...