View our GitHub

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

Edit Page

myApp/api/models

Purpose

This is the directory that holds your models. In Sails, models are the structures that contain data for your Sails App.

When you call sails generate api cats via the command line from inside your project's root directory, Sails will generate the file myApp/api/models/Cats.js as well as a matching controller. In the myApp/api/models/Cats.js file you can specify the attributes which determine how the records in your database will be defined.

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.