<commit_before>express = require 'express'
path = require 'path'
favicon = require 'serve-favicon'
logger = require 'morgan'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
passport = require 'passport'
LocalStrategy = require('passport-local').Strategy
storage = require 'node-persist'
flash = require 'connect-flash'
session = require 'express-session'
FileStore = require('session-file-store')(session)
storage.initSync()


routes = require './routes/index'
apiRoute = require './routes/api'
authRoute = require './routes/auth'
users = require "./users"

app = express()

passport.use new LocalStrategy (username, password, done) ->
  users.getUser username, password, (user) ->
    done null, user || false

passport.serializeUser (user, done) ->
  done null, user.data.username

passport.deserializeUser (user, done) ->
  users.getUser user, (user) ->
    done null, user

# view engine setup
app.set 'views', path.join(__dirname, 'views')
app.set 'view engine', 'jade'

# uncomment after placing your favicon in /public
# app.use favicon path.join(__dirname, 'public', 'favicon.ico')
app.use logger 'dev'
app.use bodyParser.json()
app.use bodyParser.urlencoded extended: false
app.use cookieParser()
app.use flash()
app.use session
  saveUninitialized: true,
  resave: true,
  secret: 'keyboard dog',
  store: new FileStore()

app.use passport.initialize()
app.use passport.session()
app.use express.static(path.join __dirname, 'public')

app.use '/', routes
app.use '/api', apiRoute
app.use '/auth', authRoute

# catch 404 and forward to error handler
app.use (req, res, next) -><commit_msg>Stop saving sessions on disk<commit_after>express = require 'express'
path = require 'path'
favicon = require 'serve-favicon'
logger = require 'morgan'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
passport = require 'passport'
LocalStrategy = require('passport-local').Strategy
storage = require 'node-persist'
flash = require 'connect-flash'
session = require 'express-session'
storage.initSync()


routes = require './routes/index'
apiRoute = require './routes/api'
authRoute = require './routes/auth'
users = require "./users"

app = express()

passport.use new LocalStrategy (username, password, done) ->
  users.getUser username, password, (user) ->
    done null, user || false

passport.serializeUser (user, done) ->
  done null, user.data.username

passport.deserializeUser (user, done) ->
  users.getUser user, (user) ->
    done null, user

# view engine setup
app.set 'views', path.join(__dirname, 'views')
app.set 'view engine', 'jade'

# uncomment after placing your favicon in /public
# app.use favicon path.join(__dirname, 'public', 'favicon.ico')
app.use logger 'dev'
app.use bodyParser.json()
app.use bodyParser.urlencoded extended: false
app.use cookieParser()
app.use flash()
app.use session
  saveUninitialized: true,
  resave: true,
  secret: 'keyboard dog'

app.use passport.initialize()
app.use passport.session()
app.use express.static(path.join __dirname, 'public')

app.use '/', routes
app.use '/api', apiRoute
app.use '/auth', authRoute

# catch 404 and forward to error handler
app.use (req, res, next) ->
{'fraction_non_alphanumeric': 0.13465160075329566, 'fraction_numerical': 0.0018832391713747645, 'mean_word_length': 4.784029038112522, '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': '3125970', 'n_tokens_mistral': 992, 'n_tokens_neox': 985, 'n_words': 305}