Build a blog with Areto Node.js framework

Database

NoSQL MongoDB is used as the main database. No need to pre-create the 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 the connection component in the application config and set the address of the database, as well as the name and login / password. Many application components depend on the database, so the connection section include at the top of the config, just after the logger.

config/default.js

module.exports = {
  ...
  components: {
    ...
    'connection': {
      schema: 'mongodb',
      settings: {
        host: 'localhost',
        port: 27017,
        database: 'areto-blog',
        user: '',
        password: ''
      }
    },
    ...
  }
};

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

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