diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-08 20:15:25 -0500 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-08 20:15:25 -0500 |
commit | 2f0d6b32ba72bf8b3c0bfe8668193c956ff9e224 (patch) | |
tree | cde005d68f483dbcaeb4672e69b5292efc39f37b /src/index.ts | |
parent | 5a9fcd606a1b124496a7131ab0bead7ae1f6ec98 (diff) | |
download | skyblock-api-2f0d6b32ba72bf8b3c0bfe8668193c956ff9e224.tar.gz skyblock-api-2f0d6b32ba72bf8b3c0bfe8668193c956ff9e224.tar.bz2 skyblock-api-2f0d6b32ba72bf8b3c0bfe8668193c956ff9e224.zip |
add Access-Control-Allow-Origin * and change ratelimit to be stricter
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index d997cde..274df36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,10 +7,10 @@ const app = express() export const debug = false -// 500 requests over 5 minutes +// 200 requests over 5 minutes const limiter = rateLimit({ windowMs: 60 * 1000 * 5, - max: 500, + max: 200, skip: (req: express.Request) => { return req.headers.key === process.env.key }, @@ -20,6 +20,10 @@ const limiter = rateLimit({ }) app.use(limiter) +app.use((req, res, next) => { + res.setHeader('Access-Control-Allow-Origin', '*') + next() +}) app.get('/', async(req, res) => { res.json({ ok: true }) |