diff options
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index 1dcb523..9311fe6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import { createSession, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingRawLeaderboards, leaderboardUpdateMemberQueue, leaderboardUpdateProfileQueue, updateAccount, deleteSession, fetchPaginatedItemsAuctions, fetchItemsAuctions } from './database.js' -import { fetchAuctionUncached, fetchElection, fetchItemList, fetchMemberProfile, fetchUser } from './hypixel.js' +import { fetchAuctionItems, fetchAuctionUncached, fetchElection, fetchItemList, fetchMemberProfile, fetchUser } from './hypixel.js' import rateLimit from 'express-rate-limit' import * as constants from './constants.js' import * as discord from './discord.js' @@ -166,7 +166,6 @@ app.get('/items', async (req, res) => { } }) - app.get('/auctionprices', async (req, res) => { const itemIds = typeof req.query.items === 'string' ? req.query.items.split(',') : null if (itemIds && itemIds.length > 100) @@ -186,6 +185,17 @@ app.get('/auctionprices', async (req, res) => { } }) +app.get('/auctionitems', async (req, res) => { + try { + res + .setHeader('Cache-Control', 'public, max-age=600') + .json(await fetchAuctionItems()) + } catch (err) { + console.error(err) + res.json({ ok: false }) + } +}) + app.get('/auction/:uuid', async (req, res) => { console.log('fetching auction', req.params.uuid) const auction = await fetchAuctionUncached(req.params.uuid) |