const list = require("../services/list.services");

async function getStations(req, res, next) {
  try {
    res.json(await list.getStations(req.body));
  } catch (err) {
    console.error("Controller Error", err.message);
    err.status = 500;
    next(err);
  }
}

async function getCorpus(req, res, next) {
  try {
    res.json(await list.getCorpus(req.body));
  } catch (err) {
    console.error("Controller Error", err.message);
    err.status = 500;
    next(err);
  }
}

async function hits(req, res, next) {
  try {
    res.json(await list.hits());
  } catch (err) {
    console.error("Controller Error", err);
    err.status = 500;
    next(err);
  }
}

module.exports = {
  getStations,
  getCorpus,
  hits,
};
