From 333864c5fe098b6993066d73b8d6d8e6fb358eb0 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 14 Apr 2025 16:54:13 +0300 Subject: [api] Removes unnecessary anonymous JS functions --- api/routes/getSBlock/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'api/routes/getSBlock/index.js') diff --git a/api/routes/getSBlock/index.js b/api/routes/getSBlock/index.js index 2fb8c80..85565b2 100644 --- a/api/routes/getSBlock/index.js +++ b/api/routes/getSBlock/index.js @@ -7,7 +7,8 @@ const { spawn } = require('child_process'); const fs = require('fs'); const config = require("../../config.js"); -module.exports = (req, res) => { +function getSBlock(req, res) +{ var args = req.url.split("/"); var sblock = args[3]; regex= /[a-f0-9]{128}/ @@ -20,16 +21,13 @@ module.exports = (req, res) => { command.stdout.on("data", data => { response_string += data; }); - command.stderr.on("data", data => { console.log(`stderr: ${data}`); }); - command.on('error', (error) => { console.log(`error: ${error.message}`); response_string={err:"error.message"}; }); - command.on("close", code => { if ( code === 0 ) { res.writeHead(200, {'Content-Type': 'application/json'}); @@ -49,4 +47,4 @@ module.exports = (req, res) => { res.end(JSON.stringify({error:"No hash"})); } } - +module.exports = getSBlock; -- cgit v1.2.3