diff --git a/apps/dashboard/src/pages/api/gas.ts b/apps/dashboard/src/pages/api/gas.ts deleted file mode 100644 index 9f8c716a847..00000000000 --- a/apps/dashboard/src/pages/api/gas.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { type NextRequest, NextResponse } from "next/server"; - -export const config = { - runtime: "edge", -}; - -const handler = async (req: NextRequest) => { - if (req.method !== "GET") { - return NextResponse.json( - { error: "invalid method" }, - { - status: 400, - }, - ); - } - - const gasPriceEndpoint = `https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=${process.env.ETHERSCAN_KEY}`; - const ethPriceEndpoint = `https://api.etherscan.io/api?module=stats&action=ethprice&apikey=${process.env.ETHERSCAN_KEY}`; - - const gasPrice = fetch(gasPriceEndpoint); - const ethPrice = fetch(ethPriceEndpoint); - - try { - const [gasPriceRes, ethPriceRes] = await Promise.all([gasPrice, ethPrice]); - const gasData = await gasPriceRes.json(); - const ethPriceData = await ethPriceRes.json(); - - if (!gasData?.result) { - return NextResponse.json( - { error: "Failed to fetch gas price" }, - { - status: 400, - }, - ); - } - - if (!ethPriceData?.result) { - return NextResponse.json( - { error: "Failed to fetch ETH price" }, - { - status: 400, - }, - ); - } - - return NextResponse.json( - { - gasPrice: gasData.result.ProposeGasPrice, - ethPrice: ethPriceData.result.ethusd, - }, - { - status: 200, - headers: [ - // cache for 60 seconds, with up to 120 seconds of stale time - ["Cache-Control", "public, s-maxage=60, stale-while-revalidate=119"], - ], - }, - ); - } catch (err) { - console.error(err); - return NextResponse.json({ error: "Invalid response" }, { status: 502 }); - } -}; - -export default handler; diff --git a/apps/dashboard/src/pages/api/luma-events.ts b/apps/dashboard/src/pages/api/luma-events.ts deleted file mode 100644 index 865e40d6529..00000000000 --- a/apps/dashboard/src/pages/api/luma-events.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { NextResponse } from "next/server"; - -export const config = { - runtime: "edge", -}; - -export default async function handler() { - const date = new Date().toISOString(); - const url = `https://api.lu.ma/public/v2/event/get-events-hosting?series_mode=series&after=${date}`; - - try { - const response = await fetch(url, { - method: "GET", - headers: { - accept: "application/json", - "x-luma-api-key": process.env.LUMA_API_KEY as string, - }, - }); - - if (!response.ok) { - return NextResponse.json( - { message: "Error fetching luma events" }, - { status: 500 }, - ); - } - - const data = await response.json(); - - return NextResponse.json(data, { status: 200 }); - } catch (error) { - return NextResponse.json( - { message: "Error fetching luma events", error }, - { status: 500 }, - ); - } -} diff --git a/apps/dashboard/src/pages/api/proxy.ts b/apps/dashboard/src/pages/api/proxy.ts deleted file mode 100644 index c92073e2336..00000000000 --- a/apps/dashboard/src/pages/api/proxy.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { NextRequest } from "next/server"; - -export const config = { - runtime: "edge", - api: { - bodyParser: false, - }, -}; -const handler = async (req: NextRequest) => { - if (req.method !== "GET") { - return new Response("Method not allowed", { status: 405 }); - } - - const url = new URL(req.url).searchParams.get("url"); - if (!url) { - return new Response("missing url", { status: 400 }); - } - - if (Array.isArray(url)) { - return new Response("missing url", { status: 400 }); - } - - const resp = await fetch(url); - return new Response(resp.body, { - headers: { - "cache-control": "public, max-age=29030400, s-maxage=29030400, immutable", - }, - }); -}; - -export default handler;