From 8a25a69ee253e4da0bc088d9d81818bd821e1b5c Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 20 Nov 2024 12:10:56 +0200 Subject: Clean up --- api/routes/getMrk/index.js | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 api/routes/getMrk/index.js (limited to 'api/routes/getMrk') diff --git a/api/routes/getMrk/index.js b/api/routes/getMrk/index.js deleted file mode 100644 index 92f8c1e..0000000 --- a/api/routes/getMrk/index.js +++ /dev/null @@ -1,38 +0,0 @@ -const fs = require("fs"); -const config = require("../../config"); - -/* - * Gets a local merkle leaf - * - * Returns: - * the merkle leaf - * - */ -function fetchFmrk(mrk, res){ - res.set('Content-Type', 'application/json'); - const path = config.workDir+"/fmrk/"+mrk; - // console.log(path) - try { - if(fs.existsSync(path)){ - res.send(fs.readFileSync(path)); - } - } catch (error) { - res.send({"error":error.message}); - } -}; - -module.exports = (req, res) => { - console.log(req.params) - res.set('Content-Type', 'application/json'); - if ( (req.params.mrk) && typeof req.params.mrk === "string" && req.params.mrk.length === 128 ){ - regex= /[a-f0-9]{128}/; - if (regex.test(req.params.mrk)){ - let mrk = req.params.mrk; - fetchFmrk(mrk,res); - } else { - res.send({error:"Invalid data: regexp failed to pass"}); - } - } else { - res.send({error:"Invalid data: no valid zblock was provided"}); - } -} -- cgit v1.2.3