<commit_before>"use strict";

var middleware = require('./middleware-boilerplate')
  , express = require('express')
  , routes = require('../route/all')
  , ejs = require('ejs')
  , favicon = require('serve-favicon')
  , path = require('path')
  , UserCtrl = require('../controller/user')
  ;

var app = express();

// middleware
middleware(app, process.env);

app.set('view engine', 'ejs');
app.set('views', path.resolve(__dirname, '../../views/pages'));

app.use(favicon(__dirname + '/../../public/icons.ico/favicon.ico'));
app.use(express.static(__dirname + '/../../public'));

// add routing
app.use('/api', routes);

app.use('/main', UserCtrl.requireUser);

app.get('/main', function (req, res) {
  if (req.info && req.info.user) {
    res.redirect('/universities/'+req.info.user.university._id.toString()+'/user/'+req.info.user._id.toString());
  } else {
    res.redirect('/login');
  }
});

app.get('/universities/:univid/user/:uid', function (req, res) {
  res.render('main', {uid: req.params.uid, univid: req.params.univid});
});<commit_msg>Update / redirect<commit_after>"use strict";

var middleware = require('./middleware-boilerplate')
  , express = require('express')
  , routes = require('../route/all')
  , ejs = require('ejs')
  , favicon = require('serve-favicon')
  , path = require('path')
  , UserCtrl = require('../controller/user')
  ;

var app = express();

// middleware
middleware(app, process.env);

app.set('view engine', 'ejs');
app.set('views', path.resolve(__dirname, '../../views/pages'));

app.use(favicon(__dirname + '/../../public/icons.ico/favicon.ico'));
app.use(express.static(__dirname + '/../../public'));

// add routing
app.use('/api', routes);

app.get('/', function (req, res) {
  res.redirect('/main');
});

app.use('/main', UserCtrl.requireUser);

app.get('/main', function (req, res) {
  if (req.info && req.info.user) {
    res.redirect('/universities/'+req.info.user.university._id.toString()+'/user/'+req.info.user._id.toString());
  } else {
    res.redirect('/login');
  }
});

app.get('/universities/:univid/user/:uid', function (req, res) {
  res.render('main', {uid: req.params.uid, univid: req.params.univid});
});
{'fraction_non_alphanumeric': 0.23906034085674804, 'fraction_numerical': 0.0, 'mean_word_length': 4.0046082949308754, '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': '5860052', 'n_tokens_mistral': 745, 'n_tokens_neox': 744, 'n_words': 122}