<commit_before>var express = require('express');
var http = require('http');
var config = require('./config.js');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('./models/user.js');
var crypto = require('crypto');

var app = express();
var server = http.createServer(app);

app.configure(function(){
  app.set('port', config.server.listenPort);
  app.use(express.bodyParser());
  app.use(express.logger('dev'));
  app.use(express.cookieParser());
  app.use(express.session({ secret: 'mySecret' }));
  app.use(passport.initialize());
  app.use(passport.session());
  app.use(express.static(config.server.distPath));
});

app.configure('development', function(){
  app.use(express.errorHandler());
});

passport.use(new LocalStrategy(
  function(username, password, done) {
    User.findOne({ username: username }, function (err, user) {
      if (err) {
        return done(err);
      }
      if (!user) {
        return done(null, false);
      }
      user.verifyPassword(password, function(err, res){
        if (err) {
          return done(err);
        }
        if (!res) {
          return done(null, false);
        } else {
          return done(null, user);
        }
      });
    });
  }
));

passport.serializeUser(function(user, done) {
  done(null, user.id);
});

// deserialize user on logout
passport.deserializeUser(function(id, done) {
  User.findById(id, function (err, user) {
    done(err, user);
  });
});

// start server
server.listen(app.get('port'), function(){
  console.log('Express server listening on port2s ' + app.get('port'));
});

// database
var mongoose = require('mongoose');
mongoose.connect(config.mongoDB.url);
mongoose.set('debug', true);

var routes = require('./routes.js');
routes.addRoutes(app, {
  products: require('./routes/products.js'),
  categories: require('./routes/categories.js'),
  auth: require('./routes/auth.js')
});

module.exports = server;


<commit_msg>changed mongoose debug mode<commit_after>var express = require('express');
var http = require('http');
var config = require('./config.js');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('./models/user.js');
var crypto = require('crypto');

var app = express();
var server = http.createServer(app);

app.configure(function(){
  app.set('port', config.server.listenPort);
  app.use(express.bodyParser());
  app.use(express.logger('dev'));
  app.use(express.cookieParser());
  app.use(express.session({ secret: 'mySecret' }));
  app.use(passport.initialize());
  app.use(passport.session());
  app.use(express.static(config.server.distPath));
});

app.configure('development', function(){
  app.use(express.errorHandler());
});

passport.use(new LocalStrategy(
  function(username, password, done) {
    User.findOne({ username: username }, function (err, user) {
      if (err) {
        return done(err);
      }
      if (!user) {
        return done(null, false);
      }
      user.verifyPassword(password, function(err, res){
        if (err) {
          return done(err);
        }
        if (!res) {
          return done(null, false);
        } else {
          return done(null, user);
        }
      });
    });
  }
));

passport.serializeUser(function(user, done) {
  done(null, user.id);
});

// deserialize user on logout
passport.deserializeUser(function(id, done) {
  User.findById(id, function (err, user) {
    done(err, user);
  });
});

// start server
server.listen(app.get('port'), function(){
  console.log('Express server listening on port2s ' + app.get('port'));
});

// database
var mongoose = require('mongoose');
mongoose.connect(config.mongoDB.url);

var routes = require('./routes.js');
routes.addRoutes(app, {
  products: require('./routes/products.js'),
  categories: require('./routes/categories.js'),
  auth: require('./routes/auth.js')
});

module.exports = server;
{'fraction_non_alphanumeric': 0.18322351748606183, 'fraction_numerical': 0.0005068423720223011, 'mean_word_length': 3.687648456057007, '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': '471244', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1236, 'n_words': 247}