In a typical model–view–controller architecture, you'll consciously separate data from the controller code that handles the data and from the view that represents a snapshot of the data. The data structure of your custom data is defined by its model. Routes are the endpoints for a client to query for the data:
Component | Usage | Recommended path in Vapor |
---|---|---|
Model | Description of data | Sources/App/Models/ |
View | Representation of data | Resources/Views/ |
Controller | Business logic of data | Sources/App/Controllers |
Routes | Endpoints for data querying | Sources/App/Routes |
In this chapter, you'll learn how to define the model of custom data used in a new application called myJournal, which is a server-side Swift power web application for personal journals.