<commit_before>"use strict";
const express     =   require("express");
const app         =   express();
const bodyParser  =   require("body-parser");
const vehicle     =   require("./models/vehicle");
const router      =   express.Router();
const infotypes   =   ["fuel","mileage","coordinates"];

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({"extended" : false}));

router.get("/",function(req,res){
    res.json({"error" : false,"message" : "Hello World"});
});

router.route("/vehicles")
    .get(function(req,res){
        let response = {};
        vehicle.find({},function(err,data){
            if(err) {
                response = {"error" : true,"message" : "Error fetching data : " + err};
            } else {
                response =  data;
            }
            res.json(response);
        });
    });
router.route("/vehicle")
    .post(function(req,res){
        let db = new vehicle(req.body);
        let response = {};
        db.save(function(err){
            if(err) {
                response = {"error" : true,"message" : "Error adding data : " + err};
            } else {
                response = {"error" : false,"message" : "Data added"};
            }
            res.json(response);
        });
    });
router.route("/vehicle/:plate/:infotype")
    .get(function(req,res){
        let infotype = req.params.infotype;
        if(infotypes.indexOf(infotype)===-1){
            res.json({"error" : true,"message" : "Error infotype : " + infotype});
        }else{
            let response = {};
            vehicle.find({"plate" : req.params.plate}, infotype + " capture_at" ,function(err,data){
                if(err) {
                    response = {"error" : true,"message" : "Error fetching data : " + err};
                } else {
                    response =  data;
                }
                res.json(response);
            });
        }
    });

app.use('/',router);

app.listen(3000);
console.log("Listening to PORT 3000");
<commit_msg>Routes refactoring (infotype) coordinates vs gps debug<commit_after>"use strict";
const express     =   require("express");
const app         =   express();
const bodyParser  =   require("body-parser");
const vehicle     =   require("./models/vehicle");
const router      =   express.Router();
const infotypes   =   ["fuel","mileage","coordinates"];

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({"extended" : false}));

router.get("/",function(req,res){
    res.json({"error" : false,"message" : "Hello World"});
});

router.route("/vehicles")
    .get(function(req,res){
        let response = {};
        vehicle.find({},function(err,data){
            if(err) {
                response = {"error" : true,"message" : "Error fetching data : " + err};
            } else {
                response =  data;
            }
            res.json(response);
        });
    });
router.route("/vehicle")
    .post(function(req,res){
        let db = new vehicle(req.body);
        let response = {};
        db.save(function(err){
            if(err) {
                response = {"error" : true,"message" : "Error adding data : " + err};
            } else {
                response = {"error" : false,"message" : "Data added"};
            }
            res.json(response);
        });
    });
router.route("/vehicle/:plate/:infotype")
    .get(function(req,res){
        let infotype = req.params.infotype;
        if(infotypes.indexOf(infotype)===-1){
            res.json({"error" : true,"message" : "Error infotype : " + infotype});
        }else{
            let response = {};
            if (infotype==="coordinates") infotype = "gps";
            vehicle.find({"plate" : req.params.plate}, infotype + " capture_at" ,function(err,data){
                if(err) {
                    response = {"error" : true,"message" : "Error fetching data : " + err};
                } else {
                    response =  data;
                }
                res.json(response);
            });
        }
    });

app.use('/',router);

app.listen(3000);
console.log("Listening to PORT 3000");

{'fraction_non_alphanumeric': 0.17206132879045996, 'fraction_numerical': 0.004380627889997567, 'mean_word_length': 1.9441260744985673, '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': '1622333', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1167, 'n_words': 222}