Skip to content

Commit

Permalink
feat: add market data endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ns212 committed Jun 20, 2024
1 parent c11a13b commit edf3fc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/evm/api/marketdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const config = {
};

export default async (request) => {
const url = 'https://api.coingecko.com/api/v3/simple/price?' + new URLSearchParams(request.query)
const url = 'https://api.coingecko.com/api/v3/simple/price?' + new URL(request.url).searchParams
const response = await fetch(url, { headers: { "accept": "application/json" } })
if (!response.ok) {
const errMsg = await response.text()
Expand All @@ -15,5 +15,5 @@ export default async (request) => {
.status(200)
.setHeader("content-type", "application/json")
.setHeader("cache-control", "public, max-age=120, s-maxage=120, stale-while-revalidate=300, stale-if-error=300")
.json(resp)
.json(data)
};

0 comments on commit edf3fc3

Please sign in to comment.