<commit_before>/**
 * Created by pablo on 16/3/17.
 */
const fs = require('fs');
const path = require("path");

module.exports = (app, express) => {

    const readRoutes = (directory = '') => {
        fs.readdirSync(path.join(__dirname, `routes/${directory}`)).forEach((name) =>{
            if(name.indexOf('.js') === -1){
                readRoutes(directory + name + "/");
                return;
            }

            let route_name  = (directory + /(.+)\.js/i.exec(name)[1]);
            let complete_route = `./routes/${route_name}`;

            switch (route_name.split(`/`)[0]){
                case `get`:
                    app.get(`${route_name.replace('get', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `post`:
                    app.post(`${route_name.replace('post', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `delete`:
                    app.delete(`${route_name.replace('delete', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `put`:
                    app.put(`${route_name.replace('put', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
            }

        });
    };
    readRoutes();

    const pkg = global.package;
    const basic_msg = { message:`${pkg.name} - versión ${pkg.version}`};
    app.get('*', (request, response, next) => response.json(basic_msg));
    app.post('*', (request, response, next) => response.json(basic_msg));
};<commit_msg>Añadidas mix rutas<commit_after>/**
 * Created by pablo on 16/3/17.
 */
const fs = require('fs');
const path = require("path");

module.exports = (app, express) => {

    const readRoutes = (directory = '') => {
        fs.readdirSync(path.join(__dirname, `routes/${directory}`)).forEach((name) =>{
            if(name.indexOf('.js') === -1){
                readRoutes(directory + name + "/");
                return;
            }

            let route_name  = (directory + /(.+)\.js/i.exec(name)[1]);
            let complete_route = `./routes/${route_name}`;

            switch (route_name.split(`/`)[0]){
                case `get`:
                    app.get(`${route_name.replace('get', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `post`:
                    app.post(`${route_name.replace('post', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `delete`:
                    app.delete(`${route_name.replace('delete', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
                case `put`:
                    app.put(`${route_name.replace('put', '')}`, (request, response, next) =>
                        require(complete_route)(app, express, request, response, next)
                    );
                    break;
            }

        });
    };
    readRoutes();

    const pkg = global.package;
    const basic_msg = { message:`${pkg.name} - versión ${pkg.version}`};
    app.get('*', (request, response, next) => response.json(basic_msg));
    app.post('*', (request, response, next) => response.json(basic_msg));
    app.delete('*', (request, response, next) => response.json(basic_msg));
    app.put('*', (request, response, next) => response.json(basic_msg));
};
{'fraction_non_alphanumeric': 0.171007371007371, 'fraction_numerical': 0.003931203931203931, 'mean_word_length': 1.6978131212723657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1907315', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1086, 'n_words': 214}