<commit_before>// Load modules and libraries
var express = require('express');
var http = require('http');
var path = require('path');
var fs = require('fs');
var flash = require('connect-flash');
var mongoose = require('mongoose');
var passport = require('passport');

// Load controllers
var home = require('./controllers/home');
var user = require('./controllers/user');
var api = require('./controllers/api');
var contact = require('./controllers/contact');

// App Configuration (API Keys, Database URI)
var config = require('./config/config.json');
var passportConf = require('./config/passport');

// Connect to database
var db = mongoose.connect(config.db);

// Initialize express application
var app = express();

// Express Configuration
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.logger('dev'));
app.use(express.favicon());
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.session({ secret: 'Bob-vs-Alice' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);

// Express Routes
app.get('/', home.index);
app.get('/login', user.getLogin);
app.post('/login', user.postLogin);
app.get('/logout', user.logout);

app.get('/signup', user.getSignup);
app.post('/signup', user.postSignup);

app.get('/account', passportConf.ensureAuthenticated, user.account);
app.get('/admin', passportConf.ensureAuthenticated, passportConf.ensureAdmin(), user.getAdmin);
app.get('/partials/:name', home.partials);

app.get('/api', api.apiBrowser);
app.get('/api/foursquare', passportConf.ensureAuthenticated, api.foursquare);
app.get('/api/tumblr', passportConf.ensureAuthenticated, api.tumblr);
app.get('/api/facebook', passportConf.ensureAuthenticated, api.facebook);

app.get('/contact', contact.getContact);
app.post('/contact', contact.postContact);

app.get('/auth/facebook', passport.authenticate('facebook', { scope: 'email' }));
app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRedirect: '/', failureRedirect: '/login' }));

app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' }));
app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/', failureRedirect: '/login' }));

app.get('/auth/twitter', passport.authenticate('twitter'));
app.get('/auth/twitter/callback', passport.authenticate('twitter', { successRedirect: '/', failureRedirect: '/login' }));


app.get('/auth/foursquare', api.foursquareAuth);
app.get('/auth/foursquare/callback', api.foursquareCallback);

app.get('*', home.index);


app.listen(app.get('port'), function() {
  console.log('Express server listening on port ' + app.get('port'));
});<commit_msg>Github authentication routes and configuration<commit_after>// Load modules and libraries
var express = require('express');
var http = require('http');
var path = require('path');
var fs = require('fs');
var flash = require('connect-flash');
var mongoose = require('mongoose');
var passport = require('passport');

// Load controllers
var home = require('./controllers/home');
var user = require('./controllers/user');
var api = require('./controllers/api');
var contact = require('./controllers/contact');

// App Configuration (API Keys, Database URI)
var config = require('./config/config.json');
var passportConf = require('./config/passport');

// Connect to database
var db = mongoose.connect(config.db);

// Initialize express application
var app = express();

// Express Configuration
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.logger('dev'));
app.use(express.favicon());
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.session({ secret: 'Bob-vs-Alice' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);

// Express Routes
app.get('/', home.index);
app.get('/login', user.getLogin);
app.post('/login', user.postLogin);
app.get('/logout', user.logout);

app.get('/signup', user.getSignup);
app.post('/signup', user.postSignup);

app.get('/account', passportConf.ensureAuthenticated, user.account);
app.get('/admin', passportConf.ensureAuthenticated, passportConf.ensureAdmin(), user.getAdmin);
app.get('/partials/:name', home.partials);

app.get('/api', api.apiBrowser);
app.get('/api/foursquare', passportConf.ensureAuthenticated, api.foursquare);
app.get('/api/tumblr', passportConf.ensureAuthenticated, api.tumblr);
app.get('/api/facebook', passportConf.ensureAuthenticated, api.facebook);

app.get('/contact', contact.getContact);
app.post('/contact', contact.postContact);

app.get('/auth/facebook', passport.authenticate('facebook', { scope: 'email' }));
app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRedirect: '/', failureRedirect: '/login' }));

app.get('/auth/github', passport.authenticate('github'));
app.get('/auth/github/callback', passport.authenticate('github', { successRedirect: '/', failureRedirect: '/login' }));

app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' }));
app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/', failureRedirect: '/login' }));

app.get('/auth/twitter', passport.authenticate('twitter'));
app.get('/auth/twitter/callback', passport.authenticate('twitter', { successRedirect: '/', failureRedirect: '/login' }));


app.get('/auth/foursquare', api.foursquareAuth);
app.get('/auth/foursquare/callback', api.foursquareCallback);

app.get('*', home.index);


app.listen(app.get('port'), function() {
  console.log('Express server listening on port ' + app.get('port'));
});
{'fraction_non_alphanumeric': 0.20607994625461876, 'fraction_numerical': 0.0013436345314074571, 'mean_word_length': 6.271062271062271, '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': '5742082', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1788, 'n_words': 345}