Build a blog with Areto Framework

Database

NoSQL MongoDB is used as the main database. No need to pre-create a table and close integration with JavaScript format is a strong advantage of MongoDB as a rapid application development tool.

In the future it means that the database is available on your system at the address below. Details of installing and running MongoDB can be found on the official website.

Setting

Add db component to application config and set the address of database, as well as name and login / password.

config/default.js

module.exports = {
  ...
  components: {
    ...
    'db': {
      Class: 'areto/db/MongoDatabase',
      settings: {
        host: 'localhost',
        port: 27017,
        database: 'areto-basic',
        options: {
          bufferMaxEntries: 0,
          keepAlive: true,
          useNewUrlParser: true
        }
      }
    },
    ...
  }
};

Restart the server, and if a connection is successful, you will see this message in logs:

info: Connection is opened: mongodb://localhost:27017/areto-blog