diff options
-rw-r--r-- | src/database.ts | 2 | ||||
-rw-r--r-- | src/index.ts | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/database.ts b/src/database.ts index d1ad8e6..7cc2f46 100644 --- a/src/database.ts +++ b/src/database.ts @@ -76,7 +76,7 @@ function getMemberLeaderboardAttributes(member: CleanMember) { } /** Fetch the names of all the leaderboards */ -async function fetchAllMemberLeaderboardAttributes(): Promise<string[]> { +export async function fetchAllMemberLeaderboardAttributes(): Promise<string[]> { return [ // we use the raw stat names rather than the clean stats in case hypixel adds a new stat and it takes a while for us to clean it ...await constants.fetchStats(), diff --git a/src/index.ts b/src/index.ts index 0c33930..a1da3e1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { fetchMemberProfile, fetchUser } from './hypixel' import express from 'express' -import { fetchMemberLeaderboard } from './database' +import { fetchAllMemberLeaderboardAttributes, fetchMemberLeaderboard } from './database' const app = express() @@ -40,5 +40,12 @@ app.get('/leaderboard/:name', async(req, res) => { ) }) +app.get('/leaderboards', async(req, res) => { + res.json( + await fetchAllMemberLeaderboardAttributes() + ) +}) + + app.listen(8080, () => console.log('App started :)')) |