<commit_before>
var express = require('express');
var fs = require('fs');
var TAFFY = require('taffy');
// load json file with db
var myData = require('./db.json');

var jsondb = JSON.stringify(myData);
var db = TAFFY(''+jsondb);

var app = express();

app.get('/philae', function(request, response, next){

	db.insert(
    	{
      		"id": 2,
      		"title": "first-trip",
      		"locations": [
        		{
          			"time": "now",
          			"latitud": "sur"
        		}
      		]
    	},
  	  function(err){
  		if(err){
  			return next({message: 'failed to query db (insert)', status: 500});
  		}

  	});

	console.log(db().get());

	try {

		fs.writeFileSync("db.json", JSON.stringify(db().get(), null, 4));

	} catch (err) {

  		return next({message: 'failed to query db (Sync)', status: 500});
	}

	response.send(200);
});

app.get('/viewer', function(request, response){

	// Show philae position tracking
	// Get info with json and send to view

	response.setHeader('Content-Type', 'application/json');<commit_msg>ISSUE #4 Fixed server.js to pass eslint<commit_after>
var express = require('express');
var fs = require('fs');
var TAFFY = require('taffy');
// load json file with db
var myData = require('./db.json');

var jsondb = JSON.stringify(myData);
var db = TAFFY(''+jsondb);

var app = express();

app.get('/philae', function(request, response, next){

  db.insert(
    {
      "id": 2,
      "title": "first-trip",
      "locations": [
        {
          "time": "now",
          "latitud": "sur"
        }
      ]
    },
    function(err){
      if(err){
        return next({message: 'failed to query db (insert)', status: 500});
      }
    });
	console.log(db().get());

	try {

		fs.writeFileSync("db.json", JSON.stringify(db().get(), null, 4));

	} catch (err) {

    return next({message: 'failed to query db (Sync)', status: 500});
	}

	response.send(200);
});

app.get('/viewer', function(request, response){

	// Show philae position tracking
	// Get info with json and send to view

	response.setHeader('Content-Type', 'application/json');
{'fraction_non_alphanumeric': 0.18575553416746873, 'fraction_numerical': 0.011068334937439845, 'mean_word_length': 2.85, 'pattern_counts': {'":': 10, '<': 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': '7513069', 'n_tokens_mistral': 758, 'n_tokens_neox': 704, 'n_words': 179}