diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 15:03:41 -0600 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 15:03:41 -0600 |
commit | 8e51f53f14c8cf8d357679296ea8f555a71b4175 (patch) | |
tree | c7610d6c955448707b211fa87726d3838e5e2764 /build/index.js | |
parent | 8d2722bdd81591feef14dd4ccdf99ac9c1309925 (diff) | |
download | skyblock-api-8e51f53f14c8cf8d357679296ea8f555a71b4175.tar.gz skyblock-api-8e51f53f14c8cf8d357679296ea8f555a71b4175.tar.bz2 skyblock-api-8e51f53f14c8cf8d357679296ea8f555a71b4175.zip |
tsc
Diffstat (limited to 'build/index.js')
-rw-r--r-- | build/index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/build/index.js b/build/index.js index bfc8b8d..91fdc29 100644 --- a/build/index.js +++ b/build/index.js @@ -6,6 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); const express_1 = __importDefault(require("express")); const hypixel_1 = require("./hypixel"); const app = express_1.default(); +app.use((req, res, next) => { + if (process.env.key && req.headers.key !== process.env.key) + // if a key is set in process.env and the header doesn't match return an error + // TODO: make this have a status code + return res.json({ error: 'Key in header must match key in env' }); + next(); +}); app.get('/', async (req, res) => { res.json({ ok: true }); }); |