View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

myApp/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().

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be immediately reflected on the website.