<commit_before>var Parse = require('Parse').Parse;
var credentials = require('./credentials');

Parse.initialize(credentials.applicationId, credentials.clientKey);

module.exports = {
    getCrimes: function(lat, lng, range, callback) {
        var query = new Parse.Query("Crime");
        query.withinMiles("location", new Parse.GeoPoint(lat, lng), range);
        query.find({
            success: function(crimes) {
                callback(crimes);
            },

            error: function(e) {
                callback(e);
            }
        });
    },

    addCrime: function(crime, callback) {
        var crimeObj = new Parse.Object("Crime");
        crimeObj.set("location", new Parse.GeoPoint(crime.latitude, crime.longitude));
        crimeObj.set("type", crime.type);
        crimeObj.save();
    }
};<commit_msg>addCrime endpoint now returns json<commit_after>var Parse = require('Parse').Parse;
var credentials = require('./credentials');

Parse.initialize(credentials.applicationId, credentials.clientKey);

module.exports = {
    getCrimes: function(lat, lng, range, callback) {
        var query = new Parse.Query("Crime");
        query.withinMiles("location", new Parse.GeoPoint(lat, lng), range);
        query.find({
            success: function(crimes) {
                callback(crimes);
            },

            error: function(e) {
                callback(e);
            }
        });
    },

    addCrime: function(crime, callback) {
        var crimeObj = new Parse.Object("Crime");
        crimeObj.set("location", new Parse.GeoPoint(crime.latitude, crime.longitude));
        crimeObj.set("type", crime.type);
        crimeObj.save(null, {
            success: function(object) {
                callback({code: 200, message: "success"});
            },

            error: function(object, err) {
                callback({code: 500, error: err});
            }
        });
    }
};
{'fraction_non_alphanumeric': 0.14077922077922078, 'fraction_numerical': 0.003116883116883117, 'mean_word_length': 2.2261306532663316, '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': '869993', 'n_tokens_mistral': 554, 'n_tokens_neox': 529, 'n_words': 105}