<commit_before>var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var db = require('./db');
var request_yelp = require('./request_yelp');
var getGeolocationData = require('./getGeolocationData');
var getRecommendation = require('./getRecommendation');

router.get('/',function(req,res){
	console.log(req.query);
	var username = req.query.username;
	var location = req.query.location;
	
	db.User.findOne({username:username},function(err,user){
		if (err){
			console.log('err finding user');
			res.send(err);
		}

		if (location){
			console.log('location provided');
			var requestObj = {location:location};
			getRecommendation(requestObj,res,user);
		}

		else {
			console.log('location not provided');
			getGeolocationData().then(function(data){
				
			})
		}

	})
})

module.exports = router;<commit_msg>[feat] server handles request to /eat with or without location<commit_after>var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var db = require('./db');
var request_yelp = require('./request_yelp');
var getGeolocationData = require('./getGeolocationData');
var getRecommendation = require('./getRecommendation');

router.get('/',function(req,res){
	console.log(req.query);
	var username = req.query.username;
	var location = req.query.location;
	
	db.User.findOne({username:username},function(err,user){
		if (err){
			console.log('err finding user');
			res.send(err);
		}

		if (location){
			console.log('location provided');
			var requestObj = {location:location};
			getRecommendation(requestObj,res,user);
		}

		else {
			console.log('location not provided');
			getGeolocationData().then(function(data){
				var latitude = data.location.lat;
				var longitude = data.location.lng;
				var requestObj = {ll:latitude+','+longitude};
				getRecommendation(requestObj,res,user);
			})
		}

	})
})

module.exports = router;
{'fraction_non_alphanumeric': 0.16193914388860237, 'fraction_numerical': 0.0, 'mean_word_length': 4.861027190332326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2085086', 'n_tokens_mistral': 684, 'n_tokens_neox': 601, 'n_words': 120}