<commit_before>"use strict";

var User = require('../models/user');


// AWS Configs
var AWS_ACCESS_KEY = '<KEY>';
var AWS_SECRET_KEY = '<KEY>';
var S3_BUCKET = 'gymbuddies-bucket';

module.exports = function ( app, passport, aws ) {
  /**
   * Handle Cors requests
   */
  app.use(function (req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Header", "Origin, X-Requested-With, " +
        "Content-Type, Accept");
    next();
  });

  app.get('/', function (req, res) {
    res.send("Welcome to GymBuddy API");
  });

  /**
   * Route the login request to passport local login
   */
  app.post('/login', passport.authenticate('local-login',
      { failureRedirect: '/notauthorized'}),
      function (req, res) {
        res.json(req.user);
      });

  /**
   * This response is sent when the user is not authenticated
   */
  app.get('/notauthorized', function (req, res) {
    res.json(403, {message: 'Invalid user.'});
  });

  /**
   * Route the register request to passport signup
   */
  app.post('/user/register', passport.authenticate('local-signup', {
    successRedirect: '/',
    failureRedirect: '/user/register'
  }));

  /**
  * Get a list of users for the communities page
  */
  app.get('/communities/users', function ( req, res ) {<commit_msg>On success callback to change the request code<commit_after>"use strict";

var User = require('../models/user');


// AWS Configs
var AWS_ACCESS_KEY = '<KEY>';
var AWS_SECRET_KEY = '<KEY>';
var S3_BUCKET = 'gymbuddies-bucket';

module.exports = function ( app, passport, aws ) {
  /**
   * Handle Cors requests
   */
  app.use(function (req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Header", "Origin, X-Requested-With, " +
        "Content-Type, Accept");
    next();
  });

  app.get('/', function (req, res) {
    res.send("Welcome to GymBuddy API");
  });

  /**
   * Route the login request to passport local login
   */
  app.post('/login', passport.authenticate('local-login',
      { failureRedirect: '/notauthorized'}),
      function (req, res) {
        res.json(req.user);
      });

  /**
   * This response is sent when the user is not authenticated
   */
  app.get('/notauthorized', function (req, res) {
    res.json(403, {message: 'Invalid user.'});
  });

  /**
   * Route the register request to passport signup
   */
  app.post('/user/register', passport.authenticate('local-signup',
    { failureRedirect: '/user/register' }),
    function ( req, res ) {
        res.json(req.user);
    }
  );

  /**
  * Get a list of users for the communities page
  */
  app.get('/communities/users', function ( req, res ) {
{'fraction_non_alphanumeric': 0.17410549612689044, 'fraction_numerical': 0.002950940612320177, 'mean_word_length': 2.9765395894428153, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2435775', 'n_tokens_mistral': 894, 'n_tokens_neox': 859, 'n_words': 214}