Managing views using the Actix Web framework
So far, we have defined all our views in the main.rs
file. This is fine for small projects; however, as our project grows, this will not scale well. Finding the right views can be hard, and updating them can lead to mistakes. It also makes it harder to remove modules from or insert them into your web application. Also, if we have all the views being defined on one page, this can lead to a lot of merge conflicts if a bigger team is working on the application, as they will all want to alter the same file if they are altering the definitions of views. Because of this, it is better to keep the logic of a set of views contained in a module. We can explore this by building a module that handles authentication. We will not be building the logic around authentication in this chapter, but it is a nice straightforward example to use when exploring how to manage the structure of a views module. Before we write any code, our web application should have...