Add moreInfo on tops

This commit is contained in:
Jéluchu 2020-09-15 10:51:12 +02:00
parent 078a75073b
commit 5c151093a9
4 changed files with 11 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# **Aruppi API** (v3.1.1)
# **Aruppi API** (v3.1.2)
> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
>

View File

@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.1.1",
"version": "3.1.2",
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js",
"scripts": {

View File

@ -42,18 +42,15 @@ const schedule = async (day) =>{
const top = async (top) =>{
const data = await homgot(`${BASE_JIKAN}top/${top.type}/${top.page}/${top.subtype}`, { parse: true });
let data
return data.top.map(doc => ({
rank: doc.rank,
title: doc.title,
image: doc.image_url,
type: doc.type,
score: doc.score,
link: doc.url,
startDate: doc.start_date,
endDate: doc.end_date
}));
if (top.subtype !== undefined) {
data = await homgot(`${BASE_JIKAN}top/${top.type}/${top.page}/${top.subtype}`, { parse: true });
} else {
data = await homgot(`${BASE_JIKAN}top/${top.type}/${top.page}`, { parse: true });
}
return data.top
};

View File

@ -23,7 +23,7 @@ router.get('/schedule/:day' , (req, res) =>{
});
router.get('/top/:type/:subtype/:page' , (req, res) =>{
router.get('/top/:type/:subtype?/:page' , (req, res) =>{
let top = {type: req.params.type, subtype: req.params.subtype, page: req.params.page}