function addReferenceToMethods(data, patterns) {
    return new Promise(resolve => {
        if (!data) {
            return resolve(data);
        }

        let auxData = data;
        let routeEndpoints = [];

        const origData = data;
        try {
            // CASE: router.route('/user').get(authorize, (req, res) => {
            let aDataRoute = auxData.split(new RegExp(`.*\\s*\\n*\\t*\\.\\s*\\n*\\t*route\\s*\\n*\\t*\\(`));
            if (aDataRoute.length > 1) {
                for (let idx = 1; idx < aDataRoute.length; ++idx) {
                    // CASE: app.get([_[get]_])('/automatic1/users/:id', (req, res) => {
                    for (let mIdx = 0; mIdx < statics.METHODS.length; ++mIdx) {
                        let method = statics.METHODS[mIdx];
                        let line = aDataRoute[idx].split(new RegExp(`\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*${method}\\s*\\n*\\t*\\(`));
                        if (line.length === 3) {
                            line[0] = line[0].split(')')[0];
                            // TODO: refactor this
                            line[2] = line[2].split(new RegExp(`\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*get\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*head\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*post\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*put\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*delete\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*patch\\s*\\n*\\t*\\(|` + `\\)(\\s*|\\n*|\\t*)\\.\\s*\\n*\\t*options\\s*\\n*\\t*\\(`))[0];
                            routeEndpoints.push((patterns[0] || '_app') + `.${method}(` + line[0] + ',' + line[2]);
                        }
                    }
                }
                auxData = aDataRoute[0] + routeEndpoints.join('\n');
            }

            /**
             * CASE: router.get(...).post(...).put(...)...
             */
            let regexChainedEndpoint = '';
            for (let idxMethod = 0; idxMethod < statics.METHODS.length; ++idxMethod) {
                regexChainedEndpoint += `(\\)\\s*\\n*\\t*\\.\\s*\\n*\\t*${statics.METHODS[idxMethod]}\\s*\\n*\\t*\\()|`;
            }
            regexChainedEndpoint = regexChainedEndpoint.replace(/\|$/, '');
            auxData = auxData.split(new RegExp(regexChainedEndpoint));
            auxData = auxData.filter(d => d);
            for (let idx = 1; idx < auxData.length; idx += 2) {
                if (auxData[idx + 1] && auxData[idx + 1].split('/*')[0].includes('*/'))
                    // Avoind modification in string of #swagger.description
                    continue;
                auxData[idx] = auxData[idx].replace('.', '____CHAINED____.');
            }
            auxData = auxData.join('');
            // END CASE

            let methods = [...statics.METHODS, 'use', 'all'];
            for (let idx = 0; idx < methods.length; ++idx) {
                for (let idxPtn = 0; idxPtn < patterns.length; ++idxPtn) {
                    let method = methods[idx];
                    let pattern = patterns[idxPtn];
                    let regexMethods = `${pattern}\\s*\\n*\\t*\\.\\s*\\n*\\t*${method}\\s*\\n*\\t*\\((?!\\[)`;
                    auxData = auxData.split(new RegExp(regexMethods));

                    /**
                     * Chained middlewares. For example: route.use(...).use(...).use(...)
                     */
                    if (auxData && auxData.length > 1 && method == 'use') {
                        for (let idxData = 1; idxData < auxData.length; ++idxData) {
                            let chainedUse = auxData[idxData].split(new RegExp(`\\)\\s*\\n*\\t*\\.\\s*\\n*\\t*use\\s*\\n*\\t*\\(`));
                            if (chainedUse.length > 1) {
                                auxData[idxData] = chainedUse.join(`) ${pattern}` + `.use([_[use]_])([_[${pattern}]_])(`);
                            }
                        }
                    }
                    auxData = auxData.join((pattern || '_app') + `.${method}([_[${method}]_])([_[${pattern}]_])(`);
                }

                if (idx == methods.length - 1) {
                    /* Adding byte position */
                    auxData = auxData.split(']_])([_[');
                    let bytePosition = auxData[0].split('([_[')[0].length;
                    for (let idxPtn = 1; idxPtn < auxData.length; ++idxPtn) {
                        try {
                            let auxBytePosition = auxData[idxPtn].split(']_])(')[1].split('([_[')[0].length;
                            auxData[idxPtn] = auxData[idxPtn].replace(']_])(', `]_])([_[${bytePosition}]_])(`);
                            bytePosition += auxBytePosition;
                        } catch (err) {
                            if (auxData[idxPtn]) {
                                auxData[idxPtn] = auxData[idxPtn].replace(']_])(', `]_])([_[${999999999999}]_])(`);
                            }
                            continue;
                        }
                    }
                    auxData = auxData.join(']_])([_[');

                    return resolve(auxData);
                }
            }
        } catch (err) {
            return resolve(origData);
        }
    });
}
Add the pattern "([_[method]_])([_[foo]_])([_[index]_])" to all endpoints. This standardize each endpoint.

'method': get, post, put, etc.

'foo': app, route, etc.

'index': id

@param {string} data file content.
@param {array} patterns array containing patterns recognized as: app, route, etc.