<commit_before>"use strict";

const env = require('dotenv').config();
const express = require('express');
const app = express();
const superRequest = require('superagent'); //request alt
const yelp = require('yelp-fusion');
const client = yelp.client(process.env.AUTHORIZATION);
const bodyParser = require('body-parser');
const PORT = process.env.PORT;

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));
app.use(express.static('./public'));



app.post('/geolocation/*', googleProxy)
app.get('/yelp/search', yelpSearchProxy);
app.get('/yelp/business', yelpBusinessProxy);
  
function googleProxy(request, response) {
  console.log('--------------------------------------received google request!' + request.body);
  superRequest
    .post(`https://www.googleapis.com/geolocation/v1/geolocate?key=${process.env.KEY}`)
    .end((err, resp) => response.send(resp));
} 



function yelpSearchProxy(request, response) {
  client.search(request.query)
    .then(resp => response.send(resp.jsonBody.businesses))
    .catch(err => console.error(err));
}

function yelpBusinessProxy(request, response) { // to get photos
  client.business(request.query.id)
    .then(resp => response.send(resp.jsonBody.photos))
    .catch(err => console.error(err));
}



app.listen(PORT,()=>console.log(`server started: ${PORT}`));<commit_msg>make the evil api work die console logs<commit_after>"use strict";

const env = require('dotenv').config();
const express = require('express');
const app = express();
const superRequest = require('superagent'); //request alt
const yelp = require('yelp-fusion');
const client = yelp.client(process.env.AUTHORIZATION);
const bodyParser = require('body-parser');
const PORT = process.env.PORT;

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));
app.use(express.static('./public'));



app.post('/geolocation/*', googleProxy)
app.get('/yelp/search', yelpSearchProxy);
app.get('/yelp/business', yelpBusinessProxy);
  
function googleProxy(request, response) {
  console.log(request.body);
  superRequest
    .post(`https://www.googleapis.com/geolocation/v1/geolocate?key=${process.env.KEY}`)
    .end((err, resp) =>{ 
      console.log(resp.body)
      response.send(resp.body)});
} 



function yelpSearchProxy(request, response) {
  client.search(request.query)
    .then(resp => response.send(resp.jsonBody.businesses))
    .catch(err => console.error(err));
}

function yelpBusinessProxy(request, response) { // to get photos
  client.business(request.query.id)
    .then(resp => response.send(resp.jsonBody.photos))
    .catch(err => console.error(err));
}



app.listen(PORT,()=>console.log(`server started: ${PORT}`));
{'fraction_non_alphanumeric': 0.19056463595839523, 'fraction_numerical': 0.0007429420505200594, 'mean_word_length': 4.841648590021692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4243233', 'n_tokens_mistral': 876, 'n_tokens_neox': 833, 'n_words': 146}