From f718485be29e7728830b80b53a17187b2aea60ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:59:23 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- proxy/server.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proxy/server.js b/proxy/server.js index 46f024fb..b42005f2 100644 --- a/proxy/server.js +++ b/proxy/server.js @@ -1,7 +1,7 @@ -const express = require('express'); -const cors = require('cors'); -const axios = require('axios'); -const rateLimit = require('express-rate-limit'); +const express = require("express"); +const cors = require("cors"); +const axios = require("axios"); +const rateLimit = require("express-rate-limit"); const app = express(); const port = 3000; @@ -9,13 +9,13 @@ const port = 3000; // CORS middleware settings const corsOptions = { origin: (origin, callback) => { - if (origin === 'https://taxonium.org') { + if (origin === "https://taxonium.org") { callback(null, true); } else { - callback(new Error('Not allowed by CORS')); + callback(new Error("Not allowed by CORS")); } }, - methods: ['GET'] + methods: ["GET"], }; // Apply CORS @@ -24,14 +24,14 @@ app.use(cors(corsOptions)); // Rate limiting middleware const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs + max: 100, // limit each IP to 100 requests per windowMs }); // Apply the rate limiter to all requests app.use(limiter); // Proxy endpoint -app.get('/proxy', async (req, res) => { +app.get("/proxy", async (req, res) => { try { const response = await axios.get(req.query.url); res.send(response.data);