const express = require('express'); const router = express.Router(); // eslint-disable-line const select = require('../db/selectDB'); const maxWagon = require('../db/maxWagon'); router.get('/:collectionFk', async(req, res) => { // var collectionFk = '273449'; const collectionFk = req.params.collectionFk; let maxWagon = ticketCollection(collectionFk); res.json({ message: 'SUCCESS', maxWagon: maxWagon }); }); module.exports = router; function ticketCollection(collectionFk) {// parametro collectionFk select.select(collectionFk, function(err, data) { maxWagon.maxWagon(collectionFk, function(err, max) { return max; }); }); }