From e2da6d2db20093ebd2a65aad35c9991ab1a02176 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 30 Mar 2023 01:09:30 +0300 Subject: Introducing an HTTP JSON API --- api/routes/showEntriesFile/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 api/routes/showEntriesFile/index.js (limited to 'api/routes/showEntriesFile') diff --git a/api/routes/showEntriesFile/index.js b/api/routes/showEntriesFile/index.js new file mode 100644 index 0000000..3dd1c40 --- /dev/null +++ b/api/routes/showEntriesFile/index.js @@ -0,0 +1,14 @@ +const fs = require('fs'); +const config = require('../../config'); + +/* + * Reads ./lol file where the zblocks are saved + * + * Returns: + * - the file, it's already in JSON format. + * + */ +module.exports = (req, res) => { + var data = JSON.parse(fs.readFileSync(config.blocksFile)); + res.send(data); +}; \ No newline at end of file -- cgit v1.2.3