/* eslint amd:true */
const users = require('../app/controllers/users');
const answers = require('../app/controllers/answers');
const avatars = require('../app/controllers/avatars');
const questions = require('../app/controllers/questions');
const index = require('../app/controllers/index');
const invite = require('../app/controllers/api/invites');
const search = require('../app/controllers/api/search');
const jwtAuth = require('../app/controllers/api/auth');


const routes = (app, passport) => {
// User Routes
  app.get('/signin', users.signin);
  app.get('/signup', users.signup);
  app.get('/chooseavatars', users.checkAvatar);
  app.get('/signout', users.signout);

  // Setting up the users api
  app.post('/users', users.create);
  app.post('/users/avatars', users.avatars);

  // Donation Routes
  app.post('/donations', users.addDonation);

  app.post('/users/session', passport.authenticate('local', {
    failureRedirect: '/signin',
    failureFlash: 'Invalid email or password.'
  }), users.session);

  app.get('/users/me', users.me);
  app.get('/users/:userId', users.show);

  // Setting the facebook oauth routes
  app.get('/auth/facebook', passport.authenticate('facebook', {
    scope: ['email'],
    failureRedirect: '/signin'
  }), users.signin);

  app.get('/auth/facebook/callback', passport.authenticate('facebook', {
    failureRedirect: '/signin'
  }), users.authCallback);

  // Setting the github oauth routes
  app.get('/auth/github', passport.authenticate('github', {
    failureRedirect: '/signin'
  }), users.signin);

  app.get('/auth/github/callback', passport.authenticate('github', {
    failureRedirect: '/signin'
  }), users.authCallback);

  // Setting the twitter oauth routes
  app.get('/auth/twitter', passport.authenticate('twitter', {
    failureRedirect: '/signin'
  }), users.signin);

  app.get('/auth/twitter/callback', passport.authenticate('twitter', {
    failureRedirect: '/signin'
  }), users.authCallback);

  // Setting the google oauth routes
  app.get('/auth/google', passport.authenticate('google', {
    failureRedirect: '/signin',
    scope: [
      'https://www.googleapis.com/auth/userinfo.profile',
      'https://www.googleapis.com/auth/userinfo.email'
    ]
  }), users.signin);

  app.get('/auth/google/callback', passport.authenticate('google', {
    failureRedirect: '/signin'
  }), users.authCallback);

  // Finish with setting up the userId param
  app.param('userId', users.user);

  // Answer Routes
  app.get('/answers', answers.all);
  app.get('/answers/:answerId', answers.show);
  // Finish with setting up the answerId param
  app.param('answerId', answers.answer);

  // Question Routes
  app.get('/questions', questions.all);
  app.get('/questions/:questionId', questions.show);
  // Finish with setting up the questionId param
  app.param('questionId', questions.question);

  // Avatar Routes
  app.get('/avatars', avatars.allJSON);

  // Home route
  app.get('/play', index.play);
  app.get('/', index.render);

  // Invite users with nodemailer
  app.post('/api/invite/user', invite.emailinvite);

  // Search Users api
  app.get('/api/search/users/:email', search.users);

  // Auth api sign up route
  app.post('/api/auth/signup', jwtAuth.signUp);
};

module.exports = routes;

@@ -397,24 +397,77 @@
 i/search');%0A
+const game = require('../app/controllers/api/game');%0A
 const jwtAut
@@ -3283,16 +3283,270 @@
 signUp);
+%0A%0A  // Game Play Routes%0A  app.post('/api/games/:id/start', game.create);%0A  app.put('/api/games/:id/start', game.update);%0A%0A  // Get game history%0A  app.get('/api/:userid/:gameid/history', game.viewOne);%0A  app.get('/api/:userid/games/history', game.viewAll)
 %0A%7D;%0A%0Amod

add game routes to routes file