Forrest logo
back to the sails tool

sails:tldr:a0c24

sails: Generate Sails Controller.
$ sails generate controller ${name}
try on your machine

The command "sails generate controller ${name}" is a command used in the Sails.js framework to generate a new controller.

  • "sails" refers to the command-line tool used to interact with the Sails.js framework.
  • "generate" is a sub-command that instructs Sails to generate a new code file or component.
  • "controller" specifies the type of component to generate, in this case, a controller.
  • "${name}" is a placeholder that should be replaced with an actual name. It represents the name of the controller. For example, if you want to create a controller named "UserController", you would replace "${name}" with "User".

When you run this command, Sails.js will create a new file in the relevant directory (usually in the "api/controllers" folder) with the specified name, followed by the word "Controller".

The generated controller file will contain a basic skeleton structure with some default methods like "index", "create", "find", "update", "destroy", etc., which can be customized based on your application's requirements.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sails tool