The MVC pattern

IGWEB's project codebase can be conceptualized as following the Model-View-Control (MVC) pattern. The MVC pattern is heavily used in the creation of web applications, and it is depicted in Figure 2.14:

Figure 2.14: The Model View Controller pattern

There are three primary components in a MVC-based application—the model, the view, and the controller. The primary purpose of models are to supply data and business rules to the application. Think of the models as the gatekeepers of the application's data needs. The models for IGWEB can be found in the shared/models folder.

Views are responsible for the output that the user sees. The focus of views is on presentation, and the rendering of the models into the user interface, in a manner that makes sense to the user. The views in IGWEB exist as the templates found in the shared/templates folder.

Controllers implement the application logic of the system, and they basically tell the application how it should behave. You can conceptualize the controller as a broker between the model and the views of an application. The controller accepts user input from the view, and it can access or mutate the state of the model. The controller may also change what the view is currently presenting. The server-side controllers in IGWEB are the route handlers found in the handlers folder. The client-side controllers in IGWEB are the route/page handlers found in the client/handlers directory.

As you go through the examples in this book, take note that all folders mentioned in a relative manner are relative to the igweb folder. 

Now that we have established how the code for the IGWEB project is organized, we can begin our journey to implement the individual sections and features that comprise our Isomorphic Go web application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.86.211