var express = require("express");
var router = express.Router();
var xpath = require("xpath");
var dom = require("xmldom").DOMParser;
var request = require("request");

var validResponce =  "SN: 123456";

var errorResponse = "PRODUCT_NOT_FOUND";

router.get("/:productCode", function(req, res, next) {
  try {
    console.log("\nRequested Serial Number : \n" + req.params.productCode);
    var productCode = req.params.productCode
    if (productCode == '0WXIVEX-11') {
      res.json(validResponce);
    } else {
      res.status(404).json(errorResponse);
    }
    
    console.log("\n********************************");
  } catch (error) {
    return res.status(500).json({
      error: err,
    });
  }
});

module.exports = router;
