From 71a0d1cf8cdf48319737d2c2601098e2603abbce Mon Sep 17 00:00:00 2001 From: tycrek Date: Mon, 5 Apr 2021 17:53:44 -0600 Subject: [PATCH] Added utils.js --- utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 utils.js diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..8e865c4 --- /dev/null +++ b/utils.js @@ -0,0 +1,9 @@ +const fs = require('fs-extra'); +const Path = require('path'); + +module.exports = { + log: console.log, + path: (...paths) => Path.join(__dirname, ...paths), + saveData: (data) => fs.writeJsonSync(Path.join(__dirname, 'data.json'), data, { spaces: 4 }), + verify: (req, tokens) => req.headers.authorization && tokens.includes(req.headers.authorization) +} \ No newline at end of file