<commit_before>const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const session = require('express-session');
const GithubStrategy = require('passport-github2').Strategy;
const passport = require('passport');
const gitHubAuth = require('./server/github-auth/auth');
const User = require('./server/db/dbmodel').Users;

const app = express();

app.use(session({ secret: 'keyboard cat',
  resave: true,
  saveUninitialized: true,
  cookie: { maxAge: 300000 },
}));
app.use(passport.initialize());
app.use(passport.session());

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
const handleRequest = require('./server/handlers');
handleRequest(app);

const mongoose = require('mongoose');
const MONGO_URI = require('./config').MONGO_URI;

const port = process.env.PORT || 3000;
app.set('port', port);
process.env.PWD = process.cwd();

const TARGET = process.env.npm_lifecycle_event;
if (TARGET !== 'devStart') {
  app.use(express.static(path.join(process.env.PWD, 'build')));
}

// serialize and deserialize
passport.serializeUser((user, done) => {
  console.log('serializeUser: ', user.accessToken);
  done(null, user);
});
passport.deserializeUser((id, done) => {
  User.findById(id, (err, user) => {
    console.log('INSIDE DESERIALZE! USER DATTA: ', user);
      if(!err) done(null, user);
      else done(err, null);
    });
});

app.get('/auth/github',
passport.authenticate('github', { scope: ['user:email'] }));

app.get('/auth/github/callback',
passport.authenticate('github', { failureRedirect: '/' }),
(req, res) => {
  console.log('SESSION:', req.session);
  res.redirect('/#');
});

mongoose.connect(MONGO_URI);
app.listen(port, () => { console.log(`Listening on http://localhost:${port}/`); });
<commit_msg>[ CLEANUP ] Refactor, lint, and cleanup index file<commit_after>const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');

const app = express();

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());

const mongoose = require('mongoose');
const MONGO_URI = require('./config').MONGO_URI;

const port = process.env.PORT || 3000;
app.set('port', port);
process.env.PWD = process.cwd();

const TARGET = process.env.npm_lifecycle_event;
if (TARGET !== 'devStart') {
  app.use(express.static(path.join(process.env.PWD, 'build')));
}

const gitAuth = require('./server/github-auth/git-auth-handlers');

gitAuth(app);

const handleRequest = require('./server/handlers');

handleRequest(app);

mongoose.connect(MONGO_URI);
app.listen(port, () => { console.log(`Listening on http://localhost:${port}/`); });

{'fraction_non_alphanumeric': 0.1945428773919206, 'fraction_numerical': 0.005315379163713678, 'mean_word_length': 5.474770642201835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1228779', 'n_tokens_mistral': 928, 'n_tokens_neox': 913, 'n_words': 178}