<commit_before>var express = require("express");
var bodyParser = require("body-parser");
var mongojs = require("mongojs");
var db = mongojs("todo", ["users", "tasks"]);

var app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(__dirname));

app.get('/users', function (req, res) {
  db.users.find(function(error, documents) {
    var mapped = documents.map(function(element) {
      return {id: element._id, username: element.username};
    });
    console.log(mapped);
    if(error !== null) {console.log("Error occurred; error message is: ", error);}
    res.send(mapped);
  });
});

app.get('/tasks', function (req, res) {
  db.tasks.find(function(error, documents) {
    var mapped = documents.map(function(element) {
      return {id: element._id, title: element.title, description: element.description, creator: element.creator, assignee: element.assignee, status: element.status};
    });
    console.log(mapped);
    if(error !== null) {console.log("Error occurred; error message is: ", error);}
    res.send(mapped);
  });<commit_msg>connected with mongoLab online database hurray<commit_after>var express = require("express");
var bodyParser = require("body-parser");
var mongojs = require("mongojs");
var dbURL = require('./config');
// console.log(dbURL);
var db = mongojs(dbURL, ["users", "tasks"], {authMechanism: 'ScramSHA1'});
var app = express();
// console.log(dbURL);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(__dirname));



app.get('/users', function (req, res) {

  db.users.find(function(error, documents) {
    if(error !== null) {console.log("Error occurred; error message is: ", error);}
    var mapped = documents.map(function(element) {
      return {id: element._id, username: element.username};
    });
    console.log('this is mapped: ',mapped);
    res.send(mapped);
  });
});

app.get('/tasks', function (req, res) {
  db.tasks.find(function(error, documents) {
    if(error !== null) {console.log("Error occurred; error message is: ", error);}
    var mapped = documents.map(function(element) {
      return {id: element._id, title: element.title, description: element.description, creator: element.creator, assignee: element.assignee, status: element.status};
    });
    console.log(mapped);
    res.send(mapped);
  });
{'fraction_non_alphanumeric': 0.18044481745698698, 'fraction_numerical': 0.000419639110365086, 'mean_word_length': 4.758454106280193, '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': '698255', 'n_tokens_mistral': 753, 'n_tokens_neox': 742, 'n_words': 169}