var express = require("express");
var router = express.Router(); // eslint-disable-line new-cap

/* GET home page. */

router.get("/", function handleIndexRequest(req, res) {
  res.render("pubmedRetraction");
});

/* API endpoint for the frontend to get a particular
 * chart.
 *
 * Parameters include 'name', which specifies the name
 * of the chart that we want to get.
 */
router.get('/get_bar_chart', function(req, res) {
    // Dummy Values
    var values = {
        continentYear: [
            ["Australia", 5],
            ["Asia", 5],
            ["Europe", 10],
            ["South America", 15],
            ["North America", 20]
        ],
        countryYear: [
            ["Australia", 10],
            ["United States", 5],
            ["France", 15],
            ["Canada", 30],
            ["Russian Federation", 10]
        ],
        journalYear: [
            ["Science", 5],
            ["Nature", 10],
            ["Pharmacology", 3],
            ["Radiology", 20],
            ["Harvard Law Review", 15]
        ]
    };

    /* XXX: Currently reading continentYear, but should
     * be able to read an arbitrary chart name. */
    res.json(values.continentYear.map(function(v) {
        return {
            name: v[0],
            value: v[1]
        };
    }));
});
module.exports = router;

@@ -1048,144 +1048,307 @@
     
-/* XXX: Currently reading continentYear, but should%0A     * be able to read an arbitrary chart name. */%0A    res.json(values.continentYear
+if (Object.keys(values).indexOf(req.query.name) === -1) %7B%0A        res.json(%7B%0A            %22result%22: %22failure%22,%0A            %22reason%22: %22Don't know how to get chart %22 + req.query.name%0A        %7D);%0A    %7D else %7B%0A        res.json(%7B%0A            %22result%22: %22success%22,%0A            %22data%22: values%5Breq.query.name%5D
 .map
@@ -1370,16 +1370,24 @@
         
+   
+     
 return %7B
@@ -1399,16 +1399,24 @@
         
+      
+  
 name: v%5B
@@ -1415,24 +1415,32 @@
 name: v%5B0%5D,%0A
+        
             
@@ -1463,24 +1463,57 @@
     
+ 
-%7D;%0A    %7D));
+       %7D;%0A            %7D)%0A        %7D);%0A    %7D
 %0A%7D);%0A
+%0A
 modu

Handle invalid query strings