import Product from './models';
import token from './token';

export const productsPOST = (req, res) => {
  const rawObject = req.body || JSON.parse(req.bodyAsString);
  if (token === rawObject.hottok) {
    const product = new Product(Object.assign(rawObject, { requested: false }));
    product.save();
    return res.json({ message: 'OK' });
  }
  return res.status(403).send({ message: 'WRONG TOKEN' });
};

export const productsGET = (req, res) => {
  const query = Product.find({ requested: false });
  query.exec((err, products) => {
    if (err) {
      return res.status(500).send({ message: 'ERROR' });
    }
    products.forEach((item) => {
      const product = item;
      product.requested = true;
      product.save();
    });
    return res.json(products);
  });
};

@@ -440,32 +440,63 @@
 (req, res) =%3E %7B%0A
+  const %7B debug %7D = req.query;%0A
   const query = 
@@ -531,16 +531,16 @@
 lse %7D);%0A
-
   query.
@@ -643,16 +643,36 @@
 ;%0A    %7D%0A
+    if (!debug) %7B%0A  
     prod
@@ -692,24 +692,26 @@
 (item) =%3E %7B%0A
+  
       const 
@@ -724,32 +724,34 @@
 t = item;%0A      
+  
 product.requeste
@@ -760,16 +760,18 @@
 = true;%0A
+  
       pr
@@ -788,20 +788,28 @@
 ();%0A    
+  
 %7D);%0A
+    %7D%0A
     retu

Add debug query string.