
var forms = require('./forms');
var captcha = require('./captcha');
var postData = require('./post-data');
var test = require('./test');

function goHome(req,res){
  res.render('home');
}

function success(req,res){
  res.render('success');
}

function failure(req,res){
  res.render('failed');
}

//register routes
module.exports = function(router){

  router.get('/',goHome);
  router.get('/forms/',goHome);
  router.get('/forms/success',success);
  router.get('/forms/failed',failure);
  router.get('/success',success);
  router.get('/failed',failure);

  router.post('/forms/submitFormData',forms.submitFormData);
  router.post('/forms/submitFormDataAlert',forms.submitFormDataAlert);

  //two step stuff
  router.post('/forms/twoStepTest',forms.twoStepTest);
  router.get('/forms/twoStepTwo',forms.twoStepTwo);
  router.post('/forms/twoStepSubmit',forms.twoStepSubmit);

  //captcha
  router.post('/forms/solveReCaptcha',captcha.solveRecaptcha);
  router.post('/forms/solveNewReCaptcha',captcha.solveNewRecaptcha);

  //post data
  router.get('/forms/postData',postData.legacyPostData); //legacy support
  router.post('/forms/postData',postData.legacyClearData); //legacy support

  router.get('/view/postData', postData.postDataView);
  router.get('/api/data',postData.getPostData); //ajax
  router.post('/api/data', postData.clearPostData);

  router.get('/forms/images',forms.renderImage);

  router.get('/forms/:bioId',forms.getCongressForm);

  router.get('/test', test);
  router.get('/test/:status', test);

  return router;
};

var forms = require('./forms');
var captcha = require('./captcha');
var postData = require('./post-data');
var test = require('./test');

function goHome(req,res){
  res.render('home');
}

function success(req,res){
  res.render('success');
}

function failure(req,res){
  res.render('failed');
}

//register routes
module.exports = function(router){

  router.get('/',goHome);
  router.get('/forms/',goHome);
  router.get('/forms/success',success);
  router.get('/forms/failed',failure);
  router.get('/success',success);
  router.get('/failed',failure);

  router.post('/forms/submitFormData',forms.submitFormData);
  router.post('/forms/submitFormDataAlert',forms.submitFormDataAlert);

  //two step stuff
  router.post('/forms/twoStepTest',forms.twoStepTest);
  router.get('/forms/twoStepTwo',forms.twoStepTwo);
  router.post('/forms/twoStepSubmit',forms.twoStepSubmit);

  //captcha
  router.post('/forms/solveReCaptcha',captcha.solveRecaptcha);
  router.post('/forms/solveNewReCaptcha',captcha.solveNewRecaptcha);

  //post data
  router.get('/forms/postData',postData.legacyPostData); //legacy support
  router.post('/forms/postData',postData.legacyClearData); //legacy support

  router.get('/view/postData', postData.postDataView);
  router.get('/api/data',postData.getPostData); //ajax
  router.post('/api/data', postData.clearPostData);

  router.get('/forms/images',forms.renderImage);

  router.get('/forms/:bioId',forms.getCongressForm);

  router.get('/test', test);
  router.get('/test/:status', test);
  router.post('/test', test);
  router.post('/test/:status', test);

  return router;
};
add POST routes for the test endpoint