aboutsummaryrefslogtreecommitdiff
path: root/index.ts
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-13 13:56:19 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-13 13:56:19 -0600
commita23103ec24128f2e24b93ad101ade6dfdd4758c3 (patch)
treec4d543a2003062a7c213d37f5d06a826c2a88798 /index.ts
parentd7b9d1fc5cfc8c648604eb1d178091873ea698a6 (diff)
downloadskyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.tar.gz
skyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.tar.bz2
skyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.zip
Basic profile stats
Diffstat (limited to 'index.ts')
-rw-r--r--index.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/index.ts b/index.ts
new file mode 100644
index 0000000..af5095b
--- /dev/null
+++ b/index.ts
@@ -0,0 +1,27 @@
+import express from 'express'
+import { fetchMemberProfile, fetchUser } from './hypixel'
+import { fetchProfile } from './hypixelCached'
+
+const app = express()
+
+
+app.get('/', async(req, res) => {
+ res.json({ ok: true })
+})
+
+app.get('/player/:user', async(req, res) => {
+ res.json(
+ await fetchUser(
+ { user: req.params.user },
+ ['profiles', 'player']
+ )
+ )
+})
+
+app.get('/player/:user/:profile', async(req, res) => {
+ res.json(
+ await fetchMemberProfile(req.params.user, req.params.profile)
+ )
+})
+
+app.listen(8080, () => console.log('App started :)')) \ No newline at end of file