aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-13 14:13:42 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-13 14:13:42 -0600
commit52e38809212133ef673d11bfa96ba3bb43c3644c (patch)
treef54408afd41cc64b64d5e82a3ad814b1bb55d4a7 /src/index.ts
parenta23103ec24128f2e24b93ad101ade6dfdd4758c3 (diff)
downloadskyblock-api-52e38809212133ef673d11bfa96ba3bb43c3644c.tar.gz
skyblock-api-52e38809212133ef673d11bfa96ba3bb43c3644c.tar.bz2
skyblock-api-52e38809212133ef673d11bfa96ba3bb43c3644c.zip
move stuff into src folder
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..af5095b
--- /dev/null
+++ b/src/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