mirror of
https://github.com/romancm/gamebrary
synced 2024-11-10 13:44:16 +00:00
popular games endpoint
This commit is contained in:
parent
34462ff230
commit
5fe4ce98fb
1 changed files with 27 additions and 0 deletions
|
@ -133,6 +133,33 @@ exports.game = functions.https.onRequest((req, res) => {
|
||||||
.catch((error) => { res.send(error) });
|
.catch((error) => { res.send(error) });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.popularGames = functions.https.onRequest((req, res) => {
|
||||||
|
res.set('Access-Control-Allow-Origin', "*")
|
||||||
|
|
||||||
|
const data = `fields
|
||||||
|
name,
|
||||||
|
screenshots.image_id,
|
||||||
|
popularity,
|
||||||
|
platforms.name;
|
||||||
|
|
||||||
|
limit 50;
|
||||||
|
where platforms = (48, 49, 130, 167, 169);
|
||||||
|
sort popularity desc;
|
||||||
|
`;
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: 'https://api-v3.igdb.com/games',
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'user-key': functions.config().igdbv3.key,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
.then(({ data }) => { res.status(200).send(data) })
|
||||||
|
.catch((error) => { res.send(error) });
|
||||||
|
});
|
||||||
|
|
||||||
exports.email = functions.https.onRequest((req, res) => {
|
exports.email = functions.https.onRequest((req, res) => {
|
||||||
res.set('Access-Control-Allow-Origin', "*")
|
res.set('Access-Control-Allow-Origin', "*")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue