<commit_before>/* Input: (lng, lat)
 * Output: [pic urls]
 */

<<<<<<< HEAD
//必須要檢查輸入，若不正確要報錯，避免重啟
=======

>>>>>>> e2629959c92c1230000fb307454a3f74d5786d37
var express = require('express');

var app = module.exports = express();

app.get('/', function(req, res) {
<<<<<<< HEAD
  console.log('Hello, you have entered the pictures API!');
=======
  console.log('Hello, here\'s the pictures API!');

>>>>>>> e2629959c92c1230000fb307454a3f74d5786d37

  if (!req.query.lat || !req.query.lng){
    return res.status(400).json({
      msg: 'latlng is required'
    });
  }
<<<<<<< HEAD

  var errors = [];
  req.onValidationError(function(msg){
    errors.push(msg);
  });

  req.checkBody('lat', {errcode: '', errmsg: ''}).notEmpty().

=======
>>>>>>> e2629959c92c1230000fb307454a3f74d5786d37
  var lat = req.query.lat;
  var lng = req.query.lng;

  console.log(typeof lng, typeof lat);

  console.log('Before finding pictures....');

  //The coordinate order is longitude, then latitude.
  Picture.geoNear([parseFloat(lng), parseFloat(lat)], {
    num: 5,
    maxDistance: 10,
    spherical: true
  }, function(err, picture){
    console.log('hello~~~~~~~');
    console.log(picture);

    var urlArray = [];<commit_msg>fix conflicts<commit_after>/* Input: (lng, lat)
 * Output: [pic urls]
 */
var express = require('express');

var app = module.exports = express();

app.get('/', function(req, res) {
  if (!req.query.lat || !req.query.lng){
    return res.status(400).json({
      msg: 'latlng is required'
    });
  }

  var lat = req.query.lat;
  var lng = req.query.lng;

  console.log('Before finding pictures....');

  //The coordinate order is longitude, then latitude.
  Picture.geoNear([parseFloat(lng), parseFloat(lat)], {
    num: 5,
    maxDistance: 10,
    spherical: true
  }, function(err, picture){
    console.log('hello~~~~~~~');
    console.log(picture);

    var urlArray = [];
{'fraction_non_alphanumeric': 0.19904963041182683, 'fraction_numerical': 0.05543822597676874, 'mean_word_length': 3.7613065326633164, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '7176745', 'n_tokens_mistral': 765, 'n_tokens_neox': 683, 'n_words': 144}