<commit_before>var config = require('./server/config/config')
var app = require('./server/server')
var logger = require('./server/utils/logger')
var mongoose = require('mongoose')

// get config
var uri = config.uri
var options = {
  user: config.user,
  pass: config.pass
}

// connect to db
mongoose.connect(uri, options).then(
  function() {
    logger.log('connected to mongoose')
  },
  function(err) {
    logger.log('error connecting to mongoose')
  }
)

app.listen(config.port, function() {
  logger.log('listen! http://localhost:' + config.port)
})<commit_msg>start a json-server in dev<commit_after>var config = require('./server/config/config')
var app = require('./server/server')
var logger = require('./server/utils/logger')
var mongoose = require('mongoose')

// get config
var uri = config.uri
var options = {
  user: config.user,
  pass: config.pass
}

// set up mock db if we're in dev
if (config.env === 'dev') {
  console.log('hitting that shit')
  var jsonServer = require('json-server')
  var server = jsonServer.create()
  var router = jsonServer.router('db.json')
  var middlewares = jsonServer.defaults()

  server.use(middlewares)
  server.use(router)
  server.listen(3001, () => {
    console.log('JSON server listening on port 3001')
  })
} else {
  // connect to db
  mongoose.connect(uri, options).then(
    function() {
      logger.log('connected to mongoose')
    },
    function(err) {
      logger.log('error connecting to mongoose')
    }
  )
}

app.listen(config.port, function() {
  logger.log('listen! http://localhost:' + config.port)
})
{'fraction_non_alphanumeric': 0.160431198478123, 'fraction_numerical': 0.0050729232720355105, 'mean_word_length': 3.7245508982035926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2379684', 'n_tokens_mistral': 507, 'n_tokens_neox': 509, 'n_words': 124}