<commit_before>express         = require 'express'
bodyParser      = require 'body-parser'
methodOverride  = require 'method-override'
logger          = require 'morgan'
errorhandler    = require 'errorhandler'
cookieParser    = require 'cookie-parser'
session         = require 'express-session'
compress        = require 'compression'
fs              = require 'fs'
less            = require 'less'
assets_manager  = require 'connect-assets'
ECT             = require 'ect'

config           = require './config'
routes           = require './routes'

app = module.exports = express()

app.set 'view engine', 'html'
app.set 'views', "#{__dirname}/templates"
app.set 'port', config.port
app.set 'x-powered-by', false

app.engine 'html', ECT(watch: true, root: "#{__dirname}/templates", ext : '.html').render

app.use compress()
app.use express.static "#{__dirname}/../public"
app.use bodyParser.json()
app.use bodyParser.urlencoded({extended: true })
app.use cookieParser(config.cookie_secret)
app.use methodOverride()
# app.use session secret: config.cookie_secret, name: 'sid', cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }

if config.env_development
  app.use logger("dev", skip: (req, res) -> res.statusCode is 304)
  app.use assets_manager("paths": config.assets)

if config.env_production
  log = fs.createWriteStream config.log_file, {flags: 'w'}
  app.use logger("combined", stream: log)
  app.use assets_manager("buildDir": "#{__dirname}/../public/assets/", "paths": config.assets)

app.get '/', routes.index
app.get '/get_uri', routes.get_uri
app.get '/stats', routes.stats
app.post '/parse', routes.parse

if config.env_development
  app.use errorhandler()

app.use (req, res, next) ->
  res.status 404
  if req.accepts 'html'
    res.render 'errors/404'<commit_msg>disabling assets compression for now.<commit_after>express         = require 'express'
bodyParser      = require 'body-parser'
methodOverride  = require 'method-override'
logger          = require 'morgan'
errorhandler    = require 'errorhandler'
cookieParser    = require 'cookie-parser'
session         = require 'express-session'
compress        = require 'compression'
fs              = require 'fs'
less            = require 'less'
assets_manager  = require 'connect-assets'
ECT             = require 'ect'

config           = require './config'
routes           = require './routes'

app = module.exports = express()

app.set 'view engine', 'html'
app.set 'views', "#{__dirname}/templates"
app.set 'port', config.port
app.set 'x-powered-by', false

app.engine 'html', ECT(watch: true, root: "#{__dirname}/templates", ext : '.html').render

app.use compress()
app.use express.static "#{__dirname}/../public"
app.use bodyParser.json()
app.use bodyParser.urlencoded({extended: true })
app.use cookieParser(config.cookie_secret)
app.use methodOverride()
# app.use session secret: config.cookie_secret, name: 'sid', cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }

if config.env_development
  app.use logger("dev", skip: (req, res) -> res.statusCode is 304)
  app.use assets_manager("paths": config.assets)

if config.env_production
  log = fs.createWriteStream config.log_file, {flags: 'w'}
  app.use logger("combined", stream: log)
  app.use assets_manager("buildDir": "public/assets/", "paths": config.assets, "compress": false)

app.get '/', routes.index
app.get '/get_uri', routes.get_uri
app.get '/stats', routes.stats
app.post '/parse', routes.parse

if config.env_development
  app.use errorhandler()

app.use (req, res, next) ->
  res.status 404
  if req.accepts 'html'
    res.render 'errors/404'
{'fraction_non_alphanumeric': 0.14510344827586208, 'fraction_numerical': 0.004965517241379311, 'mean_word_length': 3.7213541666666665, 'pattern_counts': {'":': 7, '<': 3, '<?xml version=': 0, '>': 7, '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': '5344860', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1111, 'n_words': 303}