<commit_before>'use strict';

/**
 * Main module. Setups express app, perform initiation phases and start listening.
 */

require('app-module-path').addPath(__dirname + '/libs');

const app = require('express')(),
    logger = require('utils/logger').app,
    config = require('utils/config'),
    initializers = require('initializers');

async function main() {

    // Execute initializers
    <% if (locals.useMongo) {%>await initializers.mongoose(app);<%}%>
    <% if (locals.useSequelize) {%>await initializers.sequelize(app);<%}%>
    await initializers.models(app);
    await initializers.dictionaries(app);

    await initializers.middlewares(app);
    await initializers.routes(app.route);


    app.listen(config.get('express:port'), function () {
        logger.info('Example app listening on port', config.get('express:port'));
    });
}

main().catch(error => logger.error('Startup error', error));<commit_msg>wrapped app.listen in promise<commit_after>'use strict';

/**
 * Main module. Setups express app, perform initiation phases and start listening.
 */

require('app-module-path').addPath(__dirname + '/libs');

const app = require('express')(),
    logger = require('utils/logger').app,
    config = require('utils/config'),
    initializers = require('initializers');

async function main() {

    // Execute initializers
    <% if (locals.useMongo) {%>await initializers.mongoose(app);<%}%>
    <% if (locals.useSequelize) {%>await initializers.sequelize(app);<%}%>
    await initializers.models(app);
    await initializers.dictionaries(app);

    await initializers.middlewares(app);
    await initializers.routes(app.route);


    return new Promise(function(resolve, reject) {
        app.on('error', reject)
        app.listen(config.get('express:port'), function () {
            logger.info('Example app listening on port', config.get('express:port'));
            resolve()
        });
    })
}

main().catch(error => logger.error('Startup error', error));
{'fraction_non_alphanumeric': 0.1661631419939577, 'fraction_numerical': 0.0, 'mean_word_length': 4.081841432225064, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1347616', 'n_tokens_mistral': 597, 'n_tokens_neox': 586, 'n_words': 123}