View our GitHub

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

Edit Page

Sails.js Documentation: API Reference

Table of Contents

  1. Application
    1. sails.log()
    2. sails.getBaseUrl()
  2. Blueprint API
    1. add to
    2. find where
    3. find one
    4. populate where
    5. create
    6. destroy
    7. remove from
    8. update
  3. Command Line Interface
    1. sails console
    2. sails debug
    3. sails generate
    4. sails lift
    5. sails new
    6. sails version
  4. Configuration
    1. sails.config.*
    2. sails.config.blueprints
    3. sails.config.cors
    4. sails.config.csrf
    5. sails.config.bootstrap
    6. sails.config.connections
    7. sails.config.globals
    8. sails.config.i18n
    9. sails.config.http
    10. sails.config.policies
    11. sails.config.routes
    12. sails.config.models
    13. sails.config.log
    14. sails.config.session
    15. sails.config.sockets
    16. sails.config.views
  5. Request (`req`)
    1. req.options
      1. req.options.values
      2. req.options.where
    2. req.accepts()
    3. req.acceptedLanguages
    4. req.accepted
    5. req.acceptedCharsets
    6. req.acceptsCharset()
    7. req.acceptsLanguage()
    8. req.body
    9. req.allParams()
    10. req.cookies
    11. req.fresh
    12. req.get()
    13. req.host
    14. req.file()
    15. req.ip
    16. req.headers
    17. req.is()
    18. req.ips
    19. req.isSocket
    20. req.param()
    21. req.method
    22. req.path
    23. req.params
    24. req.protocol
    25. req.secure
    26. req.query
    27. req.subdomains
    28. req.signedCookies
    29. req.socket
    30. req.url
    31. req.wantsJSON
    32. req.xhr
  6. Response (`res`)
    1. res.cookie()
    2. res.clearCookie()
    3. res.forbidden()
    4. res.json()
    5. res.get()
    6. res.jsonp()
    7. res.badRequest()
    8. res.attachment()
    9. res.location()
    10. res.negotiate()
    11. res.notFound()
    12. res.ok()
    13. res.redirect()
    14. res.status()
    15. res.send()
    16. res.view()
    17. res.set()
    18. res.serverError()
    19. res.type()
  7. Waterline (ORM)
    1. Models
      1. .count()
      2. .destroy()
      3. .findOne()
      4. .native()
      5. .findOrCreate()
      6. .query()
      7. .stream()
      8. .create()
      9. .find()
      10. .update()
    2. Populated Values
      1. .remove()
      2. .add()
    3. Queries
      1. .exec()
      2. .where()
      3. .populateAll()
      4. .limit()
      5. .populate()
      6. .sort()
      7. .skip()
    4. Records
      1. .save()
      2. .toJSON()
      3. .toObject()
  8. WebSockets
    1. Resourceful PubSub
      1. .message()
      2. .publishCreate()
      3. .publishAdd()
      4. .publishRemove()
      5. .publishDestroy()
      6. .publishUpdate()
      7. .subscribe()
      8. .subscribers()
      9. .unwatch()
      10. .watch()
      11. .unsubscribe()
    2. Socket Client
      1. io.socket.on()
      2. io.socket.delete()
      3. io.socket.get()
      4. io.socket.post()
      5. io.socket.put()
      6. io.socket.request()
    3. sails.sockets
      1. sails.sockets.blast()
      2. sails.sockets.join()
      3. sails.sockets.emit()
      4. sails.sockets.broadcast()
      5. sails.sockets.id()
      6. sails.sockets.rooms()
      7. sails.sockets.leave()
      8. sails.sockets.subscribers()
      9. sails.sockets.socketRooms()

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 reflected on the website the next time it is deployed.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book