From cac4ed883a1eac649e2f0df3191147af9b0165b9 Mon Sep 17 00:00:00 2001 From: Malted Date: Thu, 5 Sep 2024 16:39:04 -0400 Subject: [PATCH] Don't proxy replit stats requests through a nextjs api route --- package.json | 1 - pages/api/replit/stats.js | 24 ------------------------ pages/replit.js | 2 +- 3 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 pages/api/replit/stats.js diff --git a/package.json b/package.json index 9f42377a..7fce9561 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "remark": "^15.0.1", "remark-gfm": "^3.0.1", "remark-html": "^16.0.1", - "socket.io": "^4.7.5", "styled-components": "^6.1.8", "swr": "^2.2.4", "theme-ui": "^0.14", diff --git a/pages/api/replit/stats.js b/pages/api/replit/stats.js deleted file mode 100644 index d5a90161..00000000 --- a/pages/api/replit/stats.js +++ /dev/null @@ -1,24 +0,0 @@ -export default async function handler(req, res) { - if (req.method === 'GET') { - try { - const response = await fetch('http://takeout.hackclub.com/stats') - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`) - } - - const data = await response.json() - - res.status(200).json(data) - } catch (error) { - console.error('Error processing signup:', error) - res - .status(500) - .json({ message: 'Error processing signup', error: error.message }) - } - } else { - // Handle any non-POST requests - res.setHeader('Allow', ['POST']) - res.status(405).end(`Method ${req.method} Not Allowed`) - } -} diff --git a/pages/replit.js b/pages/replit.js index 1ff71d61..76dfe518 100644 --- a/pages/replit.js +++ b/pages/replit.js @@ -16,7 +16,7 @@ const ReplitPage = () => { const [stats, setStats] = useState(null) const fetchStats = async () => { - const statResponse = await fetch('/api/replit/stats') + const statResponse = await fetch('http://takeout.hackclub.com/stats') if (!statResponse.ok) throw new Error('Failed to fetch stats') const statData = await statResponse.json() console.info(statData)