<commit_before>
var passport = require('passport')
  , mongoose = require('mongoose');

var User = mongoose.model('User')
  , Project = mongoose.model('Project');

module.exports = function(app) {
  app.get('/', loadUser, render('dashboard'));
  app.get('/projects', loadProjects, render('projects'));
  app.post('/projects/create', isAuth, validateProject, saveProject, redirect('/'));
  app.get('/projects/remove/:project_id', isAuth, isProjectLeader, removeProject);
  app.get('/projects/edit/:project_id', isAuth, isProjectLeader, loadProject, render('edit'));
  app.post('/projects/edit/:project_id', isAuth, isProjectLeader, validateProject, updateProject, redirect('/'));
  app.get('/projects/:project_id/join', isAuth, isNotProjectMember, joinGroup); 
  app.get('/projects/:project_id/leave', isAuth, isProjectMember, leaveGroup); 
  app.get('/projects/:project_id/accept/:user_id', isProjectLeader, isUserPendingMember, acceptUser);
  app.get('/projects/:project_id/decline/:user_id', isProjectLeader, isUserPendingMember, declineUser);
  app.get('/p/:project_id', loadProject, render('project'));
  app.get('/search', loadSearchProjects, render('projects'));
  app.get('/auth/twitter', passport.authenticate('twitter'));
  app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/' }), redirect('/'));
  app.get('/logout', logout, redirect('/'));
};

/*
 * Render templates
 */

var render = function(path) {<commit_msg>added api routes<commit_after>
var passport = require('passport')
  , mongoose = require('mongoose');

var User = mongoose.model('User')
  , Project = mongoose.model('Project');

module.exports = function(app) {
  app.get('/', loadUser, render('dashboard'));
  app.get('/projects/edit/:project_id', loadUser, render('dashboard'));
  app.get('/p/:project_id', loadUser, render('dashboard'));
  app.get('/search', loadUser, render('dashboard'));
  app.get('/api/projects', loadProjects, render('projects'));
  app.post('/projects/create', isAuth, validateProject, saveProject, redirect('/'));
  app.get('/api/projects/remove/:project_id', isAuth, isProjectLeader, removeProject);
  app.get('/api/projects/edit/:project_id', isAuth, isProjectLeader, loadProject, render('edit'));
  app.post('/projects/edit/:project_id', isAuth, isProjectLeader, validateProject, updateProject, redirect('/'));
  app.get('/api/projects/:project_id/join', isAuth, isNotProjectMember, joinGroup); 
  app.get('/api/projects/:project_id/leave', isAuth, isProjectMember, leaveGroup); 
  app.get('/api/projects/:project_id/accept/:user_id', isProjectLeader, isUserPendingMember, acceptUser);
  app.get('/api/projects/:project_id/decline/:user_id', isProjectLeader, isUserPendingMember, declineUser);
  app.get('/api/p/:project_id', loadProject, render('project'));
  app.get('/api/search', loadSearchProjects, render('projects'));
  app.get('/auth/twitter', passport.authenticate('twitter'));
  app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/' }), redirect('/'));
  app.get('/logout', logout, redirect('/'));
};

/*
 * Render templates
 */

var render = function(path) {
{'fraction_non_alphanumeric': 0.19421487603305784, 'fraction_numerical': 0.0, 'mean_word_length': 6.352803738317757, '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': '7081201', 'n_tokens_mistral': 950, 'n_tokens_neox': 978, 'n_words': 161}