<commit_before>import path from 'path'

import Express from 'express'
import compression from 'compression'
import bodyParser from 'body-parser'

import Config from 'src/config'
import HotLoader from 'src/lib/HotLoader'

import React from 'react'
import { renderToString } from 'react-dom/server'
import { match, RouterContext } from 'react-router'

import routes from 'src/routes'
import Html from 'src/lib/Html'

const app = new Express()

HotLoader.init(app)

app.use(compression())
app.use(bodyParser.json({ limit: '20mb' }))
app.use(bodyParser.urlencoded({ limit: '20mb', extended: false }))
// app.use(favicon(path.resolve(__dirname, '../public/favicon.ico')))
app.use(Express.static(path.resolve(__dirname, '../public')))


// Server Side Rendering based on routes matched by React-router.
app.use((req, res) => {
  match({ routes, location: req.url }, (error, redirect, props) => {
    if (error)    return res.status(500).end('Internal server error')
    if (!props)   return res.status(404).end('Not found!')
    if (redirect) return res.redirect(redirect.pathname + redirect.search)
    return res.status(200).send(
      `<!doctype html>
      ${renderToString(<Html content={<RouterContext {...props} />} />)}`
    )
  })
})

// start app
app.listen(Config.port, (error) => {
  if (!error) {
    console.log(`Listening on ${Config.host}:${Config.port}`) // eslint-disable-line
  }
})

export default app<commit_msg>sanity logging<commit_after>import path from 'path'

import Express from 'express'
import compression from 'compression'
import bodyParser from 'body-parser'

import Config from 'src/config'
import HotLoader from 'src/lib/HotLoader'

import React from 'react'
import { renderToString } from 'react-dom/server'
import { match, RouterContext } from 'react-router'

import routes from 'src/routes'
import Html from 'src/lib/Html'

const app = new Express()

HotLoader.init(app)

app.use(compression())
app.use(bodyParser.json({ limit: '20mb' }))
app.use(bodyParser.urlencoded({ limit: '20mb', extended: false }))
// app.use(favicon(path.resolve(__dirname, '../public/favicon.ico')))
app.use(Express.static(path.resolve(__dirname, '../public')))


// Server Side Rendering based on routes matched by React-router.
app.use((req, res) => {
  console.log(`receiving request: ${req.url}`)
  match({ routes, location: req.url }, (error, redirect, props) => {
    if (error)    return res.status(500).end('Internal server error')
    if (!props)   return res.status(404).end('Not found!')
    if (redirect) return res.redirect(redirect.pathname + redirect.search)
    return res.status(200).send(
      `<!doctype html>
      ${renderToString(<Html content={<RouterContext {...props} />} />)}`
    )
  })
})

// start app
app.listen(Config.port, (error) => {
  if (!error) {
    console.log(`Listening on ${Config.host}:${Config.port}`) // eslint-disable-line
  }
})

export default app
{'fraction_non_alphanumeric': 0.16460055096418733, 'fraction_numerical': 0.008953168044077135, 'mean_word_length': 4.3896103896103895, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '7608055', 'n_tokens_mistral': 950, 'n_tokens_neox': 920, 'n_words': 237}