Skip to content

Database

A database is a structured collection of data organized for efficient retrieval and management. In web development, databases store and manage information essential for applications, such as user data, content, and settings.

Example use cases

  • User data storage: Storing and retrieving user profiles, preferences, and account information.
  • Content management: Managing articles, posts, or any content within an application.
  • Configuration settings: Storing and managing application settings and configurations.

Sails Disk

During development, The Boring JavaScript Stack utilizes the Sails Disk adapter for Waterline, allowing you to kickstart your app without worrying about setting up a database.

INFO

Learn more about Sails Disk on the Sails docs.

Setting up a database

To set up a database, you can choose the adapter for your chosen database and follow the setup steps.

PostgreSQL

sh
npm i sails-postgresql --save
js
module.exports.datastores = {
  default: {
    adapter: 'sails-postgresql', 
    url: 'postgresql://user:password@host:port/database'
  }
}

MySQL

sh
npm i sails-mysql --save
js
module.exports.datastores = {
  default: {
    adapter: 'sails-mysql', 
    url: 'mysql://user:password@host:port/database'
  }
}

MongoDB

sh
npm i sails-mongo --save
js
module.exports.datastores = {
  default: {
    adapter: 'sails-mongo', 
    url: 'mongodb://user:password@host:port/database'
  }
}

SQLite coming soon

INFO

The SQLite adapter is under development. You can keep an eye on the repo.

All open source projects are released under the MIT License.