message: Fixes refresh endpoint (and consequently follows)
diff: import express from 'express';
  import apolloMiddleware from 'react/apollo/middleware';
  -import logout from './middleware/logout';
  -import redirectTo from '../../lib/middleware/redirect_to';
  +import logoutMiddleware from 'apps/authentication/middleware/logout';
  +import redirectToMiddleware from 'lib/middleware/redirect_to.coffee';
  -import { StaticRoutes } from './client/index';
  -
  -const middlewareStack = [
  - apolloMiddleware,
  -];
  +import { StaticRoutes } from 'apps/authentication/client'; // TODO: Fix this
  const app = express();
  -app.set('views', `${__dirname}/templates`);
  -app.set('view engine', 'jade');
  +app
  + .set('views', `${__dirname}/templates`)
  + .set('view engine', 'jade')
  -app.get(/^\/(sign_up|log_in|forgot)/, ...middlewareStack, (req, res) => {
  - if (req.user && req.user.id) { return res.redirect('/'); }
  + .get(/^\/(sign_up|log_in|forgot)/, apolloMiddleware, (req, res) => {
  + if (req.user && req.user.id) return res.redirect('/');
  res.locals.sd.REDIRECT_TO = req.query['redirect-to'] || '/';
  return req.apollo.render(StaticRoutes)
  .then(apollo => res.render('index', { apollo }));
  -});
  -
  -app.get('/me/sign_out', logout, redirectTo);
  -app.get('/me/refresh', (req, res, next) => {
  - if (!req.user || !req.user.id) { return next(); }
  + })
  + .get('/me/sign_out', logoutMiddleware, redirectToMiddleware)
  + .get('/me/refresh', (req, res, next) => {
  const { user } = req;
  - return Promise(user.fetch())
  +
  + if (!user) return next();
  +
  + return user.fetch()
  .then((response) => {
  req.login(user, (err) => {
  - if (err) { return next(err); }
  + if (err) return next(err);
  // IMPORTANT: return the `response` instead of the `user.toJSON()`
  // Why? Because `user.toJSON()` is already parsed. Returning
  // an already parsed response will make it unparesable.
  - return req.json(response);
  + return res.json(response);
  });
  - }).catch(next);
  + })
  + .catch(next);
  });
  module.exports = app;
  