Edit Page

api/policies/

This is the folder you will store your “policy” files in. A policy file is a JavaScript file that contains what is essentially Express middleware for authenticating access to controller actions in your app.

For example, if you want to make sure only authenticated admin users can access http://yourapp.com/admin/dashboard, this is the folder you would put that logic in.

For more information about policies and how to use them in your app, see Concepts > Policies.

Want to see for yourself?

An example of this directory can be found in our sample app repo, here.

Anatomy of a Sails App