blob: af5095bf3850ed84b5802b324085c99f4c15940f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 :)'))
|