{"size": 546, "ext": "js", "max_stars_repo_path": "src/server/index.js", "max_stars_repo_name": "enbermudas/music-album-crud", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/server/index.js", "max_issues_repo_name": "enbermudas/music-album-crud", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/server/index.js", "max_forks_repo_name": "enbermudas/music-album-crud", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.7391304348, "max_line_length": 75, "alphanum_fraction": 0.6336996337}
import signale from 'signale';
import server from './config/express';
import { connect, MODE_TEST } from './config/database';
import models from './models';

const port = process.env.PORT || 8080;

connect(MODE_TEST, async (err) => {
  if (err) {
    signale.info('Unable to connect to MySQL.');

    process.exit(1);
  } else {
    signale.info('Connected to MySQL.');

    await models.sequelize.sync({ alter: true });

    server.listen(port, () => {
      signale.info(`Server is running on http://localhost:${port}/api/v1`);
    });
  }
});
