mirror of
https://codeberg.org/SafeTwitch/safetwitch-backend.git
synced 2024-12-22 21:23:01 -05:00
Make every response follow the same format
This commit is contained in:
parent
2aafaef8b4
commit
18a1d6471e
1 changed files with 16 additions and 4 deletions
|
@ -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
|
Loading…
Reference in a new issue