<commit_before>'use strict'

// ----------- Node modules -----------
const bodyParser = require('body-parser')
const express = require('express')
const expressValidator = require('express-validator')
const http = require('http')
const morgan = require('morgan')
const path = require('path')
const TrackerServer = require('bittorrent-tracker').Server
const WebSocketServer = require('ws').Server

// Create our main app
const app = express()

// ----------- Database -----------
const config = require('config')
const constants = require('./server/initializers/constants')
const database = require('./server/initializers/database')
const logger = require('./server/helpers/logger')

database.connect()

// ----------- Checker -----------
const checker = require('./server/initializers/checker')

const miss = checker.checkConfig()
if (miss.length !== 0) {
  throw new Error('Miss some configurations keys : ' + miss)
}

// ----------- PeerTube modules -----------
const customValidators = require('./server/helpers/custom-validators')
const installer = require('./server/initializers/installer')
const mongoose = require('mongoose')
const routes = require('./server/controllers')
const utils = require('./server/helpers/utils')
const webtorrent = require('./server/lib/webtorrent')
const Request = mongoose.model('Request')
const Video = mongoose.model('Video')

// Get configurations
const port = config.get('listen.port')

// ----------- Command line -----------

// ----------- App -----------

// For the logger
app.use(morgan('combined', { stream: logger.stream }))
// For body requests
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
// Validate some params for the API
app.use(expressValidator({
  customValidators: Object.assign(
    {},
    customValidators.misc,
    customValidators.pods,
    customValidators.users,
    customValidators.videos
  )<commit_msg>Server: avoid request entity too large for requests between pods<commit_after>'use strict'

// ----------- Node modules -----------
const bodyParser = require('body-parser')
const express = require('express')
const expressValidator = require('express-validator')
const http = require('http')
const morgan = require('morgan')
const path = require('path')
const TrackerServer = require('bittorrent-tracker').Server
const WebSocketServer = require('ws').Server

// Create our main app
const app = express()

// ----------- Database -----------
const config = require('config')
const constants = require('./server/initializers/constants')
const database = require('./server/initializers/database')
const logger = require('./server/helpers/logger')

database.connect()

// ----------- Checker -----------
const checker = require('./server/initializers/checker')

const miss = checker.checkConfig()
if (miss.length !== 0) {
  throw new Error('Miss some configurations keys : ' + miss)
}

// ----------- PeerTube modules -----------
const customValidators = require('./server/helpers/custom-validators')
const installer = require('./server/initializers/installer')
const mongoose = require('mongoose')
const routes = require('./server/controllers')
const utils = require('./server/helpers/utils')
const webtorrent = require('./server/lib/webtorrent')
const Request = mongoose.model('Request')
const Video = mongoose.model('Video')

// Get configurations
const port = config.get('listen.port')

// ----------- Command line -----------

// ----------- App -----------

// For the logger
app.use(morgan('combined', { stream: logger.stream }))
// For body requests
app.use(bodyParser.json({ limit: '500kb' }))
app.use(bodyParser.urlencoded({ extended: false }))
// Validate some params for the API
app.use(expressValidator({
  customValidators: Object.assign(
    {},
    customValidators.misc,
    customValidators.pods,
    customValidators.users,
    customValidators.videos
  )
{'fraction_non_alphanumeric': 0.19943167140273832, 'fraction_numerical': 0.0012916559028674762, 'mean_word_length': 3.395005675368899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3451139', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1031, 'n_words': 263}