0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 13:13:00 -05:00

Make every response follow the same format

This commit is contained in:
dragongoose 2023-04-10 12:15:05 -04:00
parent 2aafaef8b4
commit 18a1d6471e
No known key found for this signature in database
GPG key ID: 50DB99B921579009

View file

@ -12,7 +12,10 @@ profileRouter.get('/users/:username', async (req, res, next) => {
.catch(next) .catch(next)
if (streamerData) if (streamerData)
res.send(streamerData) res.send({
status: 'ok',
data: streamerData
})
}) })
profileRouter.get('/discover', async (req, res, next) => { profileRouter.get('/discover', async (req, res, next) => {
@ -25,7 +28,10 @@ profileRouter.get('/discover', async (req, res, next) => {
discoveryData = await twitch.getDirectory(15) discoveryData = await twitch.getDirectory(15)
} }
res.send(discoveryData) res.send({
status: 'ok',
data: discoveryData
})
}) })
profileRouter.get('/discover/:game', async (req, res, next) => { profileRouter.get('/discover/:game', async (req, res, next) => {
@ -33,7 +39,10 @@ profileRouter.get('/discover/:game', async (req, res, next) => {
.catch(next) .catch(next)
if(discoveryData) if(discoveryData)
res.send(discoveryData) res.send({
status: 'ok',
data: discoveryData
})
}) })
profileRouter.get('/badges', async (req, res, next) => { profileRouter.get('/badges', async (req, res, next) => {
@ -48,7 +57,10 @@ profileRouter.get('/badges', async (req, res, next) => {
} }
if(badges) if(badges)
res.send(badges) res.send({
status: 'ok',
data: badges
})
}) })
export default profileRouter export default profileRouter