Edit Page
api
Purpose
This folder contains the vast majority of your app's back-end logic. It is home to the 'M' and 'C' in MVC Framework.
In it you will find the following.
- Controllers: Controllers contain most of the back-end logic for your app.
- Models: Models are the structures that contain data for your Sails App.
- Policies: Policies are typically used to authenticate clients and restrict access to certain parts of your app.
- Responses: Server response logic (404 - Not Found, 500 - Server Error, etc)
- Services: Services are similar to controller actions. They contain logic that used by your app that doesn't necessarily rely on
.req()
and .res()
.
Want to see for yourself?
An example of this directory can be found in our sample app repo, here.