Skip to content

Latest commit

 

History

History
14 lines (8 loc) · 1.7 KB

extending-sails.md

File metadata and controls

14 lines (8 loc) · 1.7 KB

Extending Sails

In keeping with the Node philosophy, Sails aims to keep its core as small as possible, delegating all but the most critical functions to separate modules. There are currently three types of extensions that you can add to Sails:

  • Generators: for adding and overriding functionality in the Sails CLI. Example: sails-generate-model, which allows you to create models on the command line with sails generate model foo.
  • Adapters: for integrating Waterline (Sails' ORM) with new data sources, including databases, APIs, or even hardware. Example: sails-postgresql, the official PostgreSQL adapter for Sails.
  • Hooks: for overriding or injecting new functionality in the Sails runtime. Example: sails-hook-autoreload, which adds auto-refreshing for a Sails project's API without having to manually restart the server.

If you’re interested in developing a plugin for Sails, you will most often want to make a hook.

* Core hooks, like http, request, etc. are hooks which are bundled with Sails out of the box. They can be disabled by specifying a hooks configuration in your .sailsrc file, or when lifting Sails programatically.