<commit_before>import Boom from 'boom';
import raidStore from '../stores/raidStore';

const raidController = {
  createRaid(req, reply) {
    raidStore.createRaid(req.payload)
    .then((raid) => {
      reply(raid).code(201);
    })
    .catch((err) => {
      req.server.log('Error. Could not create Raid');
      Boom.badRequest(err);
    });
  },
  getRaids(req, reply) {
    raidStore.getRaids()
      .then((raids) => {
        reply(raids).code(200);
      })
      .catch((err) => {
        reply(Boom.badRequest(err));
      });
  },
};

export default raidController;
<commit_msg>added working hapi route example in raidController<commit_after>import Boom from 'boom';
import raidStore from '../stores/raidStore';

const raidController = {
  async createRaid(req, reply) {
    raidStore.createRaid(req.payload)
    .then((raid) => {
      reply(raid).code(201);
    })
    .catch((err) => {
      req.server.log('Error. Could not create Raid');
      Boom.badRequest(err);
    });
  },
  async getRaids(req, h) {
    let raids;
    try {
      raids = await raidStore.getRaids();
      const response = h.response(raids);
      return response;
    } catch (err) {
      console.error("getRaids error: ", err);
      h.response(Boom.badRequest(err));
    }
  },
};

export default raidController;

{'fraction_non_alphanumeric': 0.15990818668706963, 'fraction_numerical': 0.006885998469778117, 'mean_word_length': 2.7803468208092488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6808849', 'n_tokens_mistral': 450, 'n_tokens_neox': 437, 'n_words': 84}