<commit_before>import newrelic from 'artsy-newrelic';
import xapp from 'artsy-xapp';
import cors from 'cors';
import debug from 'debug';
import morgan from 'morgan';
import express from 'express';
import graphqlHTTP from 'express-graphql';
import schema from './schema';
import loaders from './lib/loaders';

const {
  PORT,
  GRAVITY_API_URL,
  GRAVITY_ID,
  GRAVITY_SECRET
} = process.env

let app = express();
let port = PORT || 3000;

app.use(newrelic);

xapp.on('error', debug('error'));
xapp.init({
  url: GRAVITY_API_URL,
  id: GRAVITY_ID,
  secret: GRAVITY_SECRET
}, () => require('./config').GRAVITY_XAPP_TOKEN = xapp.token);

app.get('/favicon.ico', (req, res) => {
  res
    .status(200)
    .set({ 'Content-Type': 'image/x-icon' })
    .end();
});

app.all('/graphql', (req, res) => res.redirect('/'));

app.use('/', cors(), morgan('combined'), graphqlHTTP((req) => {
  loaders.clearAll();

  return {
    schema: schema,
    graphiql: true
  }
}));

app.listen(port, () => debug('info')(`Listening on ${port}`));<commit_msg>Crash in addition to logging the error<commit_after>import newrelic from 'artsy-newrelic';
import xapp from 'artsy-xapp';
import cors from 'cors';
import debug from 'debug';
import morgan from 'morgan';
import express from 'express';
import graphqlHTTP from 'express-graphql';
import schema from './schema';
import loaders from './lib/loaders';

const {
  PORT,
  GRAVITY_API_URL,
  GRAVITY_ID,
  GRAVITY_SECRET
} = process.env

let app = express();
let port = PORT || 3000;

app.use(newrelic);

xapp.on('error', (err) => {
  debug('error')(err);
  process.exit;
});

xapp.init({
  url: GRAVITY_API_URL,
  id: GRAVITY_ID,
  secret: GRAVITY_SECRET
}, () => require('./config').GRAVITY_XAPP_TOKEN = xapp.token);

app.get('/favicon.ico', (req, res) => {
  res
    .status(200)
    .set({ 'Content-Type': 'image/x-icon' })
    .end();
});

app.all('/graphql', (req, res) => res.redirect('/'));

app.use('/', cors(), morgan('combined'), graphqlHTTP((req) => {
  loaders.clearAll();

  return {
    schema: schema,
    graphiql: true
  }
}));

app.listen(port, () => debug('info')(`Listening on ${port}`));
{'fraction_non_alphanumeric': 0.19326158165652785, 'fraction_numerical': 0.006551240056153486, 'mean_word_length': 4.292079207920792, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '5159227', 'n_tokens_mistral': 827, 'n_tokens_neox': 816, 'n_words': 183}