<commit_before>const express = require('express')
const bodyParser = require('body-parser')
const mongoose = require('mongoose')

const Question = require('./model/Question.js')

const app = express()

const mongooseOption = {
  useMongoClient: true,
  server: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
  replset: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
}

mongoose.connect(
  'mongodb://imcvampire:<EMAIL>:11535/simple-online-form',
  mongooseOption
)

app.use(bodyParser.json())
app.disable('etag')

app.get('/api/questions', (req, res) => {
  Question.getAllQuestions((error, questions) => {
    if (error) res.status(500).end()

    res.json(questions)
  })
})<commit_msg>feat(server): serve client static in production<commit_after>const express = require('express')
const bodyParser = require('body-parser')
const mongoose = require('mongoose')

const Question = require('./model/Question.js')

const app = express()

const mongooseOption = {
  useMongoClient: true,
  server: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
  replset: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
}

mongoose.connect(
  'mongodb://imcvampire:<EMAIL>:11535/simple-online-form',
  mongooseOption
)

app.use(bodyParser.json())
app.disable('etag')

if (process.env.NODE_ENV === 'production') {
  app.use(express.static('../../client/build'))
}

app.get('/api/questions', (req, res) => {
  Question.getAllQuestions((error, questions) => {
    if (error) res.status(500).end()

    res.json(questions)
  })
})
{'fraction_non_alphanumeric': 0.16834804539722573, 'fraction_numerical': 0.03783102143757881, 'mean_word_length': 5.080459770114943, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6158414', 'n_tokens_mistral': 576, 'n_tokens_neox': 531, 'n_words': 99}