<commit_before>'use strict';

const cors = require('cors');
const morgan = require('morgan');
const express = require('express');
const mongoose = require('mongoose');

mongoose.Promise = Promise;
mongoose.connect(process.env.MONGODB_URI);

const app = express();
const server = module.exports = {};

app.use(morgan('dev'));
app.use(cors());

app.use(require('../routes/profile-router'));
app.use(require('../routes/trade-router'));
app.use(require('../routes/auth-router'));
app.use(require('./error-handler'));

//eslint-disable-next-line
app.all('/api/*', (req, res, next) => res.sendStatus(404));

server.isOn = false;
server.start = () => {
  return new Promise((resolve, reject) => {
    /* istanbul ignore next */
    if (!server.isOn) {
      server.http = app.listen(process.env.PORT, () => {
        server.isOn = true;
        console.log('server is running on PORT ', process.env.PORT);
        resolve();
      });
      return;
    }
    /* istanbul ignore next */
    reject(new Error('server is already running'));
  });
};

server.stop = () => {
  return new Promise((resolve, reject) => {
    /* istanbul ignore next */
    if (server.http && server.isOn) {
      return server.http.close(() => {
        server.isOn = false;
        console.log('server just got killed');
        resolve();
      });
    }
    /* istanbul ignore next */
    reject(new Error('server is not runnnig'));
  });
};<commit_msg>minor revision<commit_after>'use strict';

const cors = require('cors');
const morgan = require('morgan');
const express = require('express');
const mongoose = require('mongoose');

mongoose.Promise = Promise;
mongoose.connect(process.env.MONGODB_URI);

const app = express();
const server = module.exports = {};

app.use(morgan('dev'));
app.use(cors());

app.use(require('../routes/profile-router'));
app.use(require('../routes/trade-router'));
app.use(require('../routes/auth-router'));
app.use(require('./error-handler'));

//eslint-disable-next-line
app.all('/api/*', (req, res, next) => res.sendStatus(404));

server.isOn = false;
server.start = () => {
  return new Promise((resolve, reject) => {
    /* istanbul ignore next */
    if (!server.isOn) {
      server.http = app.listen(process.env.PORT, () => {
        server.isOn = true;

        // console.log('server is running on PORT ', process.env.PORT);

        resolve();
      });
      return;
    }
    /* istanbul ignore next */
    reject(new Error('server is already running'));
  });
};

server.stop = () => {
  return new Promise((resolve, reject) => {
    /* istanbul ignore next */
    if (server.http && server.isOn) {
      return server.http.close(() => {
        server.isOn = false;

        // console.log('server just got killed');

        resolve();
      });
    }
    /* istanbul ignore next */
    reject(new Error('server is not runnnig'));
  });
};
{'fraction_non_alphanumeric': 0.1943376441803565, 'fraction_numerical': 0.0020971688220901784, 'mean_word_length': 3.1002865329512894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2429389', 'n_tokens_mistral': 907, 'n_tokens_neox': 909, 'n_words': 191}