<commit_before>const express = require('express')
const bodyParser = require('body-parser')
const next = require('next')
const co = require('co')
const config = require('config')
const { MongoClient } = require('mongodb')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

// MongoDB
const MONGO_URL = `${config.server.mongo.url}/${config.server.mongo.dbName}`

co(function * () {
  yield app.prepare()
  console.log('> App prepared.')

  // TODO enable when api impled
  /* eslint-disable no-unused-vars */
  const db = yield MongoClient.connect(MONGO_URL)
  console.log(`> Connect to ${MONGO_URL}`)

  const server = express()

  server.use(bodyParser.json())

  // server.use('/api', api(db))

  server.get('*', (req, res) => {
    return handle(req, res)
  })

  server.listen(config.server.express.port, (err) => {
    if (err) throw err
    console.log(`> Ready on http://localhost:${config.server.express.port}`)
  })
}).catch(error => console.error(error.stack))<commit_msg>Add server setting of serving static files.<commit_after>const express = require('express')
const bodyParser = require('body-parser')
const next = require('next')
const co = require('co')
const config = require('config')
const { MongoClient } = require('mongodb')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

// MongoDB
const MONGO_URL = `${config.server.mongo.url}/${config.server.mongo.dbName}`

co(function * () {
  yield app.prepare()
  console.log('> App prepared.')

  // TODO enable when api impled
  /* eslint-disable no-unused-vars */
  const db = yield MongoClient.connect(MONGO_URL)
  console.log(`> Connect to ${MONGO_URL}`)

  const server = express()

  server.use(bodyParser.json())

  server.use('/static', express.static('static'))

  // server.use('/api', api(db))

  server.get('*', (req, res) => {
    return handle(req, res)
  })

  server.listen(config.server.express.port, (err) => {
    if (err) throw err
    console.log(`> Ready on http://localhost:${config.server.express.port}`)
  })
}).catch(error => console.error(error.stack))
{'fraction_non_alphanumeric': 0.17776757005052826, 'fraction_numerical': 0.0, 'mean_word_length': 4.235576923076923, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3887151', 'n_tokens_mistral': 718, 'n_tokens_neox': 694, 'n_words': 163}