Build a blog with Areto Node.js framework

Startup scripts

Create a bin directory. There will be located application startup scripts.

The first and main script is the start of the web server. It contains configuration and initialization of the application.

bin/server.js

(async ()=> {
  try {
    const application = require('../module');
    await application.init(process.env.NODE_ENV);
    await application.start();
  } catch (err) {
    console.error(err);
  }
})();

Configuring Visual Studio Code launch:

{
  "configurations": [{
    "type": "node",
    "request": "launch",
    "name": "Start app",
    "program": "${workspaceFolder}/bin/server.js",
    "env": {
      "NODE_ENV": "development"
    }
  },{
    "type": "node",
    "request": "launch",
    "name": "Init app",
    "program": "${workspaceFolder}/bin/migrate.js",
    "env": {
      "NODE_ENV": "development"
    }
  }]
}

Start!

When the web server has started successfully, you will receive a console message:

info blog started in development { address: '::', family: 'IPv6', port: 3000 }