Chapter 5. Custom backend code

This chapter covers

  • Setting up the initial state of your application
  • Introduction to custom asynchronous code in Sails
  • Counting the number of records in your database
  • Creating a new record in your database
  • Accessing a third-party API

Almost every commercial web application requires some way to run custom code “on lift,” before it begins listening for requests. This usually involves creating seed data, like admin user accounts. As we introduce custom backend code in this chapter, we’ll show how to use the config/bootstrap.js file to set up the data your application needs at startup.

Next, we’ll provide an introduction to communicating with third-party APIs. Specifically, we’ll show how to install open source ...

Get Sails.js in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.